Check 2 Dates?

andy_dyer

Registered User.
Local time
Today, 20:16
Joined
Jul 2, 2003
Messages
806
Hi,

I am wanting to be able to on my form closing check two date fields.

If the second is dates before the first i wish to have an error come up.

Does anyone know what VBA I would need to check these dates?
 
Perhaps this will work.

Code:
Dim dtfirstdate as date, dtseconddate as date

dtfirstdate = me.yourfirstdatefield
dtseconddate = me.yourseconddatefield

If dtseconddate < dtfirstdate then
msgbox ("your date is not valid")
me.yourseconddatefield.setfocus
end if

Fuga.
 
Last edited:
Thanks!

That worked a treat!

Should've known that though... didn't think it was that straight forward!!
 

Users who are viewing this thread

Back
Top Bottom