Malcolmneill
Registered User.
- Local time
- Today, 09:00
- Joined
- May 7, 2011
- Messages
- 17
Hi,
I'm having another "Date" issue. I am trying to compare 2 dates to check that the "Sale Date" does not exceed the "Expiry Date". I have tried various ways to do this using a reference to the fields in the loaded form and a table, tried using a TempVar but none work! I think it's probably due to differences in the data type although both are defined as date. Here's an example
[CODE}
If [TempVars]![batch_date] > [Forms]![Items - Sales Details Update]![Expiry Date] Then
MsgBox strmsg, vbOKOnly, "Sale Date Exceeds Expiry date - Not allowed"
The "TempVar" is set up in thepreviously loaded form
[CODE}
If MsgBox("Correct Date Selected?", vbOKCancel + vbQuestion, "Batch Date Check") = vbCancel Then
Me.Undo
Else
TempVars.Add "Batch_update", "[Forms]![Batch Items by Sold Date]![Form Select date]"
I tried using the field directly from the table i.e.
If [Tables]![Operators]![ Form Select Date] > etc.
But that gave me an error Name not defined. Does it matter that the DB is an external one?
Anyway, some pointers/help would be appreciated.
Thanks
Malcolm
:banghead:
I'm having another "Date" issue. I am trying to compare 2 dates to check that the "Sale Date" does not exceed the "Expiry Date". I have tried various ways to do this using a reference to the fields in the loaded form and a table, tried using a TempVar but none work! I think it's probably due to differences in the data type although both are defined as date. Here's an example
[CODE}
If [TempVars]![batch_date] > [Forms]![Items - Sales Details Update]![Expiry Date] Then
MsgBox strmsg, vbOKOnly, "Sale Date Exceeds Expiry date - Not allowed"
The "TempVar" is set up in thepreviously loaded form
[CODE}
If MsgBox("Correct Date Selected?", vbOKCancel + vbQuestion, "Batch Date Check") = vbCancel Then
Me.Undo
Else
TempVars.Add "Batch_update", "[Forms]![Batch Items by Sold Date]![Form Select date]"
I tried using the field directly from the table i.e.
If [Tables]![Operators]![ Form Select Date] > etc.
But that gave me an error Name not defined. Does it matter that the DB is an external one?
Anyway, some pointers/help would be appreciated.
Thanks
Malcolm
:banghead: