Verifying data before entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a 'Verify' button on a form. When I click the button, I want it to
check if the value of a yes/no field is true and the value of a date field is
null, then to show a message box saying that the user forgot to enter a date.
I can't seem to get it to work. Please help. Here's what I'm trying to
type:

If dc.value = true and dcpostdate.value = null then Msgbox "You forgot the
posted date"
End If

It shows the value of dcpostdate is null but the code does not return the
message box. I have tried setting the default value to null and it doesn't
work.
 
Access doesn't recognise it when you check if a field or variable equal to
null when you write
Field=Null
Instead you should use the function isnull

If me.dc = true and isnull(me.dcpostdate) then ....
 
I have a 'Verify' button on a form. When I click the button, I want
it to check if the value of a yes/no field is true and the value of a
date field is null, then to show a message box saying that the user
forgot to enter a date.
I can't seem to get it to work. Please help. Here's what I'm trying
to
type:

If dc.value = true and dcpostdate.value = null then Msgbox "You forgot
the posted date"
End If

It shows the value of dcpostdate is null but the code does not return
the message box. I have tried setting the default value to null and
it doesn't work.

Hi Newbie,

'value' is the default property for most controls so it can be left off.

If 'dc' is a CheckBox and 'dcpostdate' is a TextBox then the following
'aircode' should work:

If Me.dc AND IsNull(Me.dcpostdate) Then
MsgBox "You forgot the posted date"
Me.dcpostdate.SetFocus
End If

HTH
 
Back
Top