If statement syntax Not working

TallMan

Registered User.
Local time
Today, 10:54
Joined
Dec 5, 2008
Messages
239
Good afternoon all,

I am working on a form where there is a starts on text box (me.starts_On_PPY) and an ends on text box (Me.ends_on_PPY) both fields are in short date format like the underlying table that this information gets appended to.

I am trying to build an IF statement to make sure information is added correctly to the underlying table.

If there is an end date the day of the end date needs to = the day of the start date. However, there is not always an ends on date.....

This is what I have but I am getting a "object required" error.

PHP:
If ((Me.Ends_On_PPY Is Not Null Or Me.Ends_On_PPY <> "") And (Day(Me.Starts_On_PPY) <> Day(Me.Ends_On_PPY))) Then
         MsgBox "blah blah blah"
 
 
End If

Do you guys see anything wrong?
 
Try

Code:
If ((Not IsNull(Me.Ends_On_PPY)  Or Me.Ends_On_PPY <> "") And (Day(Me.Starts_On_PPY) <> Day(Me.Ends_On_PPY))) Then
         MsgBox "blah blah blah"
  
End If
Also suspect that you really want

Format(Day(Me.Starts_On_PPY), "DDD") or even 4 Ds if you want the day in full

Brian
 
Worked great! Thank you!
 

Users who are viewing this thread

Back
Top Bottom