I am trying to get a report, based on a query, to open on the current record in the form I am currently in. I have a command control which when clicked issues the following:
stDocName = "rptQuinnClaim"
sSQL = "[tblQuinn.MemberNumber] = " & Me.MemberNumber & " And [tblQuinn.Date] = " & Me.Date
DoCmd.OpenReport stDocName, acPreview, , sSQL
When this command is issued the preview report is not on any record, but if I go into design view for the report, I see the correct values in the parameters in the Filter: ([tblQuinn.MemberNumber] = 123456789 and [tblQuinn.Date] = 23/08/2008).
If I select the value in the Filter, and delete it and then click on Preview again I get the preview I wanted, i.e. the preview shows the correct Member Number and Date. I am mystified as to why it doesn't do it first time as I have used exactly the same kind of code in other reports.
Any suggestions would be greatly appreciated, as I am getting increasingly frustrated.
stDocName = "rptQuinnClaim"
sSQL = "[tblQuinn.MemberNumber] = " & Me.MemberNumber & " And [tblQuinn.Date] = " & Me.Date
DoCmd.OpenReport stDocName, acPreview, , sSQL
When this command is issued the preview report is not on any record, but if I go into design view for the report, I see the correct values in the parameters in the Filter: ([tblQuinn.MemberNumber] = 123456789 and [tblQuinn.Date] = 23/08/2008).
If I select the value in the Filter, and delete it and then click on Preview again I get the preview I wanted, i.e. the preview shows the correct Member Number and Date. I am mystified as to why it doesn't do it first time as I have used exactly the same kind of code in other reports.
Any suggestions would be greatly appreciated, as I am getting increasingly frustrated.