andy_dyer Registered User. Local time Today, 20:16 Joined Jul 2, 2003 Messages 806 Oct 15, 2003 #1 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?
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?
Fuga Registered User. Local time Today, 21:16 Joined Feb 28, 2002 Messages 566 Oct 15, 2003 #2 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: Oct 15, 2003
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.
andy_dyer Registered User. Local time Today, 20:16 Joined Jul 2, 2003 Messages 806 Oct 15, 2003 #3 Thanks! That worked a treat! Should've known that though... didn't think it was that straight forward!!
Thanks! That worked a treat! Should've known that though... didn't think it was that straight forward!!