Value Field in ADD mode

Gerrit.B

Board Regular
Joined
Aug 10, 2004
Messages
237
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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Set the field properties to Enabled by setting the On Load property in the form properties
Alan
 
Last edited:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,853
Members
449,471
Latest member
lachbee

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
Back
Top