Invaild Use Of Null?

RyanB

Registered User.
Local time
Today, 10:36
Joined
Jul 13, 2004
Messages
53
Hi all,

Having this problem on a form when a button is clicked to launch another form and my code makes sure that the one of the fields on the form isn't empty/Null, I keep getting the error 'Invaild use of Null', but Access just doesn't seem to read it as a null in my code. See Below

Private Sub butAttach_Click()

If ARNo.Value = Null Then
MsgBox "Please enter an AR Number before adding a PDF document to the database", vbOKOnly, "Add A PDF Document"
Exit Sub
Else:
arnum = ARNo.Value <- THIS IS WHERE THE ERROR OCCURS
DoCmd.OpenForm "frmselect"

End If
End Sub

The field in question ARNo.Value has a control source which is set to number.

Am I doing something wrong here??

Cheers,

Ryan
 
Never mind, I worked it out. for anyone interested here is the solution...

Private Sub butAttach_Click()

If IsNull(Me![ARNo]) Then
MsgBox "Please enter an AR Number before adding a PDF document to the database", vbOKOnly, "Add A PDF Document"
Exit Sub
Else:
arnum = ARNo.Value
DoCmd.OpenForm "frmselect"

End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom