Value Field in ADD mode

Gerrit.B

Board Regular
Joined
Aug 10, 2004
Messages
234
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I want to disable some buttons depanding on a value of a field.
If the value >0 then all the buttons enabled.
But now my problem, when adding a record the value off the field is empty.
I tried is null but that didn't work!

Current Code.

If Me.SelectedAWB > 0 Or Null Then
me.cmd1.Enabled=true
Else
me.cmd1.Enabled=False
End If
End Sub

How can i fix this problem.

G.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
6,877
Office Version
  1. 365
Platform
  1. Windows
Set the field properties to Enabled by setting the On Load property in the form properties
Alan
 
Last edited:

revans

Well-known Member
Joined
Apr 5, 2010
Messages
576
try

Code:
If Me.SelectedAWB > 0 Or IsNull(Me.SelectedAWB) Then
...


hth,

Rich
 

Gerrit.B

Board Regular
Joined
Aug 10, 2004
Messages
234
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Both solutions didn't work for me.
Now if you code below the appropriate burrons.

Private Sub Command103_Click()
fnPause (2)
On Error GoTo Err1:
DoCmd.GoToControl "SelectedAWB"
DoCmd.RunCommand acCmdCopy
Err1: DoCmd.CancelEvent
MsgBox "Not possible if no record is selected", vbOKOnly
End Sub

This works only when a record is sewlected it shows this message, it may only be seen as the error accours.
What should is change in the code.

G.
 

Gerrit.B

Board Regular
Joined
Aug 10, 2004
Messages
234
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Private Sub Command103_Click()
fnPause (2)
On Error GoTo Err1:
DoCmd.GoToControl "SelectedAWB"
DoCmd.RunCommand acCmdCopy
Exit Sub
Err1: MsgBox "Not possible if no record is selected", vbOKOnly
End Sub

Solved problems with code above.

G.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,713
Messages
5,833,269
Members
430,200
Latest member
ADLHMA2022

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top