I've successfully created a queryDef that words correctly using SQL. It's created by:
Now I want to run a report based on this query"
If I use the PrintOut Method of DoCmd as stated above, I will get the the first four pages of my report printed out, two copies each.
My Question: how do I make this dynamic? In other words, the report will have a different amount of pages whenever I run it. - So I tried this:
which counts the records in my recordset, and then:
Which does seem to work - although it may not be the best way.
But now, I want to be able to manipulate the number of copies that each page of my report prints out, based on a field in qryResult called NumOfLocations - I.E. - I need to substitute a variable for the "2" to change every time the report page advances to reflect whatever number is in that underlying field called NumOfLocations that is included in the qryResult, which in turn is the source for my rptPostingNotice - HERE IS WHERE I'M STUCK!!!!!
Maybe I shouldn't even be using PrintOut? Help!
I don't know if I've explained this adequately. Q: Why is my computer doing that?
A: Random Perversity of Inanimate
Objects
Code:
'Call CreateQueryDef method
Set qdf = CurrentDb.CreateQueryDef("qryResult", strSQL)
Now I want to run a report based on this query"
Code:
'Open the report based on this query
DoCmd.OpenReport "rptPostingNotice", acViewPreview
DoCmd.PrintOut acPages, 1, 4, , 2
If I use the PrintOut Method of DoCmd as stated above, I will get the the first four pages of my report printed out, two copies each.
My Question: how do I make this dynamic? In other words, the report will have a different amount of pages whenever I run it. - So I tried this:
Code:
intRecordCount = DCount("[MemberID]", "qryResult")
Code:
DoCmd.PrintOut acPages, 1, intRecordCount, , 2
Which does seem to work - although it may not be the best way.
But now, I want to be able to manipulate the number of copies that each page of my report prints out, based on a field in qryResult called NumOfLocations - I.E. - I need to substitute a variable for the "2" to change every time the report page advances to reflect whatever number is in that underlying field called NumOfLocations that is included in the qryResult, which in turn is the source for my rptPostingNotice - HERE IS WHERE I'M STUCK!!!!!
Maybe I shouldn't even be using PrintOut? Help!
I don't know if I've explained this adequately. Q: Why is my computer doing that?
A: Random Perversity of Inanimate
Objects