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.
 

Some videos you may like

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
5,855
Office Version
  1. 2019
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,131
Messages
5,527,016
Members
409,735
Latest member
viktor90

This Week's Hot Topics

Top