Required Options

  • Thread starter Thread starter Morgan Gartland via AccessMonster.com
  • Start date Start date
M

Morgan Gartland via AccessMonster.com

Hi I have a drop down list on a form the has two options Min or Max.
the table the form is based on is using a look up wizard for the minmax
field.

I want this field to be filled in before the user can move on. I donot want
to this at table level as the users will not understand the access message.
ideally i want to force the user to enter min or max and nothing else, i
have tried If IsNull that seemed to work at home on access 2003 but not at
work on access 2000.

Code i used at home:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Controls("MinOrMax").Value) Then
Cancel = True
MsgBox "Please enter Min Or Max for the MinOrMax Field", _
vbOKOnly + vbInformation
End If
End Sub


IF anyone could provide an answer i would be most grateful as i have only
been using VBA for about a month now.

Morgan
 
Try this:

If Nz(Me.NameOfYourComboControl.Column(0),"") = "" Then
Msgbox "Enter something"
Cancel = True
Me.NameOfYourComboControl.SetFocus
End If

This is assuming your combo has 1 column ...
 
Cheers Scott

That works fine.
One more question, What does the Nz stand for?
If Nz(Me.id.Column(0), "") = "" Then

Morgan
 
Back
Top