Matching Dates Problem

T

trekgoes2malaysia

I have a date field in a report (data type is medium date i.e. 20-
Feb-08) and a date control on a form (also in medium date format). I
am trying to filter the report by date according to the date the user
enters on the form. My problem is that when a user enters a date in
the form control, the report is not filterd by that date, even though
the dates and format are the same among the two documents. I have
noticed in my VBA code that the date captured from the form control is
given as "02/20/08" instead of "20-Feb-08". I am not sure if this is
the problem but regardless, how can I get around my dilemma.

Patrick
 
S

Stefan Hoffmann

hi Patrik,

My problem is that when a user enters a date in
the form control, the report is not filterd by that date, even though
the dates and format are the same among the two documents.
Check

a) the fields storing your dates are really DATETIME fields
b) that they don't contain a TIME part.



mfG
--> stefan <--
 
T

trekgoes2malaysia

hi Patrik,



Check

a) the fields storing your dates are really DATETIME fields
b) that they don't contain a TIME part.

mfG
--> stefan <--

I set the format property to medium date in my form control, table,
report and query so they should not be datetime and the problem still
exists. Any other ideas??
Patrick
 
D

Dale Fye

Patrick,

The format property in the data table and in the controls has nothing to do
with what "data" is actually stored in the field, just how it is displayed.

How are you trying to implement this filter? I would put some code in the
Click event of a command button that opens your report:

Private Sub cmd_Report_Click

Dim strWhere as string

strWhere = "DateValue([DateFieldName]) = #" & me.txt_FilterDate & "#"
docmd.OpenReport "ReportName", acViewPreview, , strWhere, acDialog

End Sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 

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