Validation

brucey54

Registered User.
Local time
Today, 13:34
Joined
Jun 18, 2012
Messages
155
Hi Folks, need some help here, not sure if my code is correct, I’m trying to validate some values when a Form is opened i.e.

If ReturnValue is not equal today Date -1 OR ReturnValue is not equal to today Date Then run the following Marco

Private Sub Form_Load()
ReturnValue = DLookup("ReOrderDate", "TblReOrderDate", "ReOrderDate =date()")
If ReturnValue <> Date - 1 Or ReturnValue <> Date Then
stDocName = "McrReOrder"
DoCmd.RunMacro stDocName
End If
End Sub
 
I'm confused, because based on the criteria, the DLookup can only return today's date or Null if no record with today's date exists.
 
Hi pbaldy, I’m confused too lol,

Basically if DLookup returns today’s date the order has been placed, if not then the code will run the macro that will place the order in the order table, it’s unique to this setup!!!


The code should do the following; If ReturnValue is not equal today Date -1 OR ReturnValue is not equal to today Date Then run the following MarcoPlaceOrder
 
Again, the return value can't possibly be date -1. Try

If IsNull(ReturnValue) Then
 

Users who are viewing this thread

Back
Top Bottom