Is Null

Lyncroft

QPR for ever
Local time
Today, 23:42
Joined
May 18, 2002
Messages
168
I've a main form and on that form you access another form by clicking a button. How do I make sure that a certain field on the main form has been filled in before going to the new form.

I thought is must be something to do with IsNull but can't figure it.
 
Lyncroft,

In the OnClick event for your Command Button,

If IsNull(Me.txtSomething) Then
MsgBox("Please enter this field")
Exit Sub
End If

DoCmd.OpenForm ...

Wayne
 
This might help.

If Me.check1 = 0 Then
Cancel = True
MsgBox "You Must Enter bLAH bLAH."
DoCmd.GoToControl "[check1]"
Else
If IsNull(Me.check2) Then
Cancel = True
MsgBox "You Must Enter blah blah here too."
DoCmd.GoToControl "[check2]"
Else
docmd.openform "Next Form"
 
Don't forget to save the currrent record before opening the new form.

DoCmd.RunCommand acCmdSaveRecord
 

Users who are viewing this thread

Back
Top Bottom