Form always shows day after today

gadjet

Registered User.
Local time
Today, 04:45
Joined
Jan 21, 2008
Messages
45
Hi,
I'm looking at modifying an existing database with a form that when opened finds the first record with todays date (or should do).

Code:
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveLast
rs.MoveFirst
rs.FindFirst "[dates] >= CDate('" & Now & "')"

The problem is that it always shows tomorrows date instead of today, I've tried changing >= to just = but then it just shows the first record.

Anyone any ideas, is it the format of the date?

Cheers,
Phil
 
Change this part:

rs.FindFirst "[dates] >= CDate('" & Now & "')"

to

rs.FindFirst "[dates] >= Date()

as NOW includes time and so that can mess things up.
 
Change this part:

rs.FindFirst "[dates] >= CDate('" & Now & "')"

to

rs.FindFirst "[dates] >= Date()

as NOW includes time and so that can mess things up.

Thanks boblarson,
Using the date function worked in the end, I'd tried it before without any luck but eventually I found a control on the form called 'date' so this screwed up the Date() function.

That's what happens when you try to modify someone elses work.

Sorted!
 

Users who are viewing this thread

Back
Top Bottom