Date Validation Code

FranD

Registered User.
Local time
Today, 09:52
Joined
Feb 29, 2000
Messages
32
I have have two forms - frmLogBatch and frmCloseBatch. The user enters a DateReceived on the form frmLogBatch and then later enters a DateClosed on the frmCloseBatch. I have a command button on the frmLogBatch which launches the frmCloseBatch and links the two forms via the Control# field (primary key in both underlying tables). What I'm trying to do is write code which prevents users from enterring a DateClosed which preceeds the DateReceieved. Here's what I put in the frmClosed Before Update event property:

If DateClosed < DLookUp ("[DateReceived]","LogBatch","[Control#]="&[Forms]![frmLogBatch]![[Control#]) Then
.......

The error message I'm getting is "Data Type Mismatch". I don't understand why, since both fields are a date/time data type.

Can anyone help.....

Thanks - Fran
 
Thanks Pat

I'm still getting an error message, but this time its a syntax error. The Control# is not a date field, the DateClosed and Date Received are the date fields. So I tried to put the pound signs around thos fields and that didn't work either.

Any other suggestions.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom