Passing a Date to a Report

Kodama76

Registered User.
Local time
Today, 11:56
Joined
Dec 3, 2002
Messages
35
I have a form that shows a calendar...to make a long story short I want to open a report (Report1) and have it only show those records that have the same date as the day I'm on in the form. This value is stored in the aGridDate(intControl) that you see below. I know there are records for that day but nothing comes up in the report...even if I just stick todays date in instead of aGridDate.

I think this has to do with how I am phrasing the Where statement...what the heck am I doing wrong here?

Code:
Private Sub PrntReport(intControl As Integer)
   Dim stDocName As String

 stDocName = "Report1"
 DoCmd.OpenReport stDocName, acPreview, , "[Mailing]![Drop Date]=" & aGridDate(intControl)

End Sub

For this example
The report is called Report1, table for the report is called Mailing and the date field I am trying to filter on from that table is called Drop Date.

Any ideas would be appreciated.
 
DoCmd.OpenReport stDocName, acPreview, , "[Mailing]![Drop Date]=" & me!aGridDate(intControl)

???
kh
 
what's aGridDate or intControl?

which is the control on the form that has the date entered that you want to filter on?
 
I kind of found a way around my problem by having it open a popup form instead and setting some fields on that form to match the data I want so I guess this isn't a problem any more but I'd love to know why this doesn't work.

Thanks for the help, I'm sure thats what I would need were this a normal field but I made a mistake before when I said that aGridDate(intControl) was a field....its Dim that I created in the code on that form. It holds the date of the "calendar day" that the person clicked on.

I'm able to pass that to the form I'm using as a work-around and so far so good but is there a different way for me to reference that kind of variable since this doesn't seem to be right: "[Mailing]![Drop Date]=" & me!aGridDate(intControl)

Thanks again
 

Users who are viewing this thread

Back
Top Bottom