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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,214,539
Messages
6,120,100
Members
448,944
Latest member
SarahSomethingExcel100

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