Re: Verifying data before entry



<Newbie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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

--
RuralGuy

Please reply to the newsgroup so all may benefit.
.