D
Duane
I am trying to pass the value of an option group in the Forms OpenArgs
property to my report in order to select the correct recordsource at
runtime. I have one report (had three but I want to cut it down to only
one). I have three queries, each using the same fields but different
results.
Dim iPrtRpt as Integer
If iReports = 1 Then
iPrtRpt = 1
ElseIf iReports = 2 Then
iPrtRpt = 2
ElseIf iReports = 3 Then
iPrtRpt = 3
End If
I used a msgbox to verify the variable has the correct value. I am confused
on how to pass the value to the report and call the correct query for the
recordsource.
DoCmd.OpenReport ReportName:= "rptInventory" , OpenArgs:= iPrtRpt '''Tried
with quotes and without the quotes.
On the Reports Open Event I tried to use the the following:
If iPrtRpt = 1 Then
Reports!repInventory.RecordSource = "qryDrawer"
ElseIf iPrtRpt = 2 Then
Reports!repInventory.RecordSource = "qryLocation"
ElseIf iPrtRpt = 3 Then
Reports!repInventory.RecordSource = "qryWorkArea"
End If
I am not getting any errors, just a blank report. Also, I would like to
ensure the report opens in acPreview. Any help would be greatly
appreciated.
Maybe in the near future I will be asking for clarification on writing the
select statement in VBA and bypassing the queries all together. Next week I
hope!
property to my report in order to select the correct recordsource at
runtime. I have one report (had three but I want to cut it down to only
one). I have three queries, each using the same fields but different
results.
Dim iPrtRpt as Integer
If iReports = 1 Then
iPrtRpt = 1
ElseIf iReports = 2 Then
iPrtRpt = 2
ElseIf iReports = 3 Then
iPrtRpt = 3
End If
I used a msgbox to verify the variable has the correct value. I am confused
on how to pass the value to the report and call the correct query for the
recordsource.
DoCmd.OpenReport ReportName:= "rptInventory" , OpenArgs:= iPrtRpt '''Tried
with quotes and without the quotes.
On the Reports Open Event I tried to use the the following:
If iPrtRpt = 1 Then
Reports!repInventory.RecordSource = "qryDrawer"
ElseIf iPrtRpt = 2 Then
Reports!repInventory.RecordSource = "qryLocation"
ElseIf iPrtRpt = 3 Then
Reports!repInventory.RecordSource = "qryWorkArea"
End If
I am not getting any errors, just a blank report. Also, I would like to
ensure the report opens in acPreview. Any help would be greatly
appreciated.
Maybe in the near future I will be asking for clarification on writing the
select statement in VBA and bypassing the queries all together. Next week I
hope!