FindFirst with Date

D

DJ

On my form, I'm trying to locate at the first record record > or = to
today's date.

Testing at today's date 8th June (08/06/08 UK time), record keeps locating
at one with date = 6th August (06/08/08 UK time). I guess this must be where
problem lies. Any idea how to get around this? code follows:

Dim theDate As Date
theDate = Date
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "(fulldate >= #" & theDate & "#)"
Me.Bookmark = rst.Bookmark
 
D

Douglas J. Steele

Regardless of what your regional settings may be, you cannot use dd/mm/yyyy
format in SQL (which includes filters such as FindFirst).

Use

rst.FindFirst "(fulldate >= " & Format(theDate, "\#yyyy\-mm\-dd\#")

For more information, see Allen Browne's "International Dates in Access" at
http://allenbrowne.com/ser-36.html or what I had in my September 2003 Access
Answers column for Pinnacle Publication's "Smart Access" newsletter. (The
column and accompanying database can be downloaded for free at
http://www.accessmvp.com/djsteele/SmartAccess.html)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top