Filter Report By Date Field Of Current Record

M

Mike

Hello. I am trying to filter a report based on the date value in a
field within the currently selected record. I am fairly new to Access
and am not sure if I am trying something possible or not. What I have
created is a simple input form with one of the fields (not the key)
being a date field that is automatically filled with the current date
when the user saves the record. A button on the form calls a report to
send data to Excel. Through automation, further processing in Excel
creates a CSV file. This part works fine, but as of now the report
includes all entered records. The number of records input for any given
date would vary, so what I hoped would be possible is filtering the
output to records with a like date depending on which record the user
has active. My attempts at adding a filter statement to the report
output command have not worked. Am I on the right track ? Any
suggestions would be appreciated.

Thanks,

Mike Hatton
 
J

John Milward

Mike


I am not absolutely clear on your form and report setup.
I would have thought this this would be easier using a query to send the
data to excel, although the same principal applies regarding filtering.

However taking your queastion literaly I think what you need is something
like this.

strDocName = "MyReportName"
strFilter = "Datefield = #" & Format([Me.Datefield], "mm/dd/yy") & "#"

DoCmd.OpenReport strDocName, acPreview, , strFilter

(You need the format because for some reason report filtering only seems to
works in mm/dd/yy format.)


HTH


John
 

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

Similar Threads


Top