By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

Setting recordsource of a report using openarg

100+
P: 374
I use a modified version of the Allen Browne filter script to select records from a query.

The code concludes with the following statement to create the SQL to select the correct records:

Expand|Select|Wrap|Line Numbers
  1. Me.subfrmlogforfiltering.Form.RecordSource = "Select " & topinsert & " * FROM logforfiltering WHERE " & strWhere
I am then trying to pass this through a print button as openargs so the records shown load up in the report:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptlogforfiltering", acViewPreview, OpenArgs:=Me.subfrmlogforfiltering.Form.RecordSource
Then in the report I have:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Me.RecordSource = Me.OpenArgs
  3. End Sub
However the form is just opening with an empty record. Can anyone see anything missing here? I have used a debug.print to show what is being sent in the open args and all seems correct. I have also checked the recordsource and this is showing the correct sql also but no records being shown...

Expand|Select|Wrap|Line Numbers
  1. Openargs print: Select All * FROM logforfiltering WHERE (([NCStatus] = 'Initial Notification'))
  2. Recordsource print: Select All * FROM logforfiltering WHERE (([NCStatus] = 'Initial Notification'))
Jul 18 '10 #1

✓ answered by munkee

fixed!

for some reason the report had the filter as (false). Therefore stopping any records being displayed. Deleting this out did the trick.

Share this Question
Share on Google+
1 Reply


100+
P: 374
fixed!

for some reason the report had the filter as (false). Therefore stopping any records being displayed. Deleting this out did the trick.
Jul 18 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.