If Not IsDate syntax needed for If Statement (Thanks)

D

Dave Elliott

These controls are being referred to from a sub-form on the enter event.
Problem is that Text427 is a date field and for this scenario it should be
without a date in it.
The rest of the code beyond Text427 works ok!
What do I need to change?



If Not Me.Parent!Text427 And Me.Parent!Text412 > 0 And Me.Parent!Text414 = 0
Then
MsgBox "Why is there more Time being put on this job?"
End If
 
N

Nikos Yannacopoulos

Dave,

You are treating Text427 as if it were bound to a Yes/No field
(Boolean), whereas what you should be checking is if it is Null. Try:

If IsNull(Me.Parent!Text427) And Me.Parent!Text412 > 0 And
Me.Parent!Text414 = 0
Then
MsgBox "Why is there more Time being put on this job?"
End If

HTH,
Nikos
 
D

Dave Elliott

OK, but the code does not fire,something to do with Text427 being a date I
think
Unsure of syntax, but If Not IsDate is what i think the start of code for
Text427 should be!
If Text427 has no date then , etc...
What else can i try?

If IsNull(Me.Parent!Text427) And Me.Parent!Text412 > 0 And
Me.Parent!Text414 = 0
Then
MsgBox "Why is there more Time being put on this QUOTE?"
End If
 
D

Dave Elliott

Thanks for your help, this is the syntax that finally worked.

If Not IsDate(Me.Parent![StartDte] And Me.Parent!LblPrtQuot.Visible = True)
Then
MsgBox "Why is there more Time being put on this QUOTE?"
End If
 
D

Douglas J. Steele

Sorry, but that definitely doesn't look correct!

The IsDate function is going to operate on the expression
Me.Parent![StartDte] And Me.Parent!LblPrtQuot.Visible = True. If
Me.Parent!LblPrtQuot is visible, that means Me.Parent![StartDte] And -1 =
True, so in essence it's Anding -1 to a value.

You sure you don't mean

If Not IsDate(Me.Parent![StartDte]) And (Me.Parent!LblPrtQuot.Visible =
True) Then

?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Dave Elliott said:
Thanks for your help, this is the syntax that finally worked.

If Not IsDate(Me.Parent![StartDte] And Me.Parent!LblPrtQuot.Visible =
True) Then
MsgBox "Why is there more Time being put on this QUOTE?"
End If
Nikos Yannacopoulos said:
Dave,

You are treating Text427 as if it were bound to a Yes/No field (Boolean),
whereas what you should be checking is if it is Null. Try:

If IsNull(Me.Parent!Text427) And Me.Parent!Text412 > 0 And
Me.Parent!Text414 = 0
Then
MsgBox "Why is there more Time being put on this job?"
End If

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top