Ron, I think you missed the points in the reply:
a) If the fields is formatted as Short Date, that's a really good way to
confuse the user about the presence of the time component. Setting the
Format property does not prevent a time being entered (typically because the
Default value was set to Now() instead of Date()); it just prevents Access
from displaying it. But the query will not return any records when you ask
for the particular date (except those entered at exactly midnight.)
b) The return value of Date() is the system date in your local format. In my
country, it returns 4/1/2008 today. If you append that into the string (as
in your example), the query will return records for April Fools Day, not 4th
January. For more inforamation about that, see:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
On Thu, 3 Jan 2008 23:24:28 +0900, "Allen Browne"
Good point that I missed: regardless of your locale, Jet works with
the US date format for queries.
-Tom.
You cannot use your own local date format in the Filter of the string: it
needs to be in the format expected by JET. It also needs # around it as
the
delimiter:
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False 'Save first.
strWhere = "[Ring-back-date] = " & Format(Date, "\#mm/dd/yyyy\#")
Me.Filter = strWhere
Me.FilterOn = True
If your date field may have a time component in it, use:
strWhere = "([Ring-back-date] >= " & Format(Date, "\#mm/dd/yyyy\#") & ")
AND ([Ring-back-date] < " & Format(Date + 1, "\#mm/dd/yyyy\#")- Hide
quoted text -
- Show quoted text -
If [Ring-back-date] is a short date formated date field then I believe
the following should probably work also:
strWhere = "[Ring-back-date] = #" & date() & "#"