To open multi report on Access using DoCmd OpenReport (1 Viewer)

Nyan Win

New member
Local time
Today, 22:50
Joined
Jun 19, 2020
Messages
8
Hi Guys,
I want to open different Access reports by a combobox using DoCmd OpenReport, Opening single report is OK.
But I want for multiple report at the same time. Pls help How can I code for it .

My codes are as follows:
Private Sub cmdOpenReport_Click()
On Error GoTo Err_Process

If (Not IsNull(Me.cboTownship_Name_Eng)) Then
DoCmd.OpenReport "Entry_cost", acViewPreview, , "Township_Code=" & Me.txtTsp_Pcode
Else
MsgBox "You must select a Township." & vbCrLf & vbCrLf & "Please try again.", vbExclamation, "No Township Selected"
End If

Exit_Process:
Exit Sub
Err_Process:
MsgBox "Procedure: cmdOpenReport" & vbCrLf & vbCrLf & Err.Number & " " & Err.Description, vbExclamation, "Error"
Resume Exit_Process

End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:20
Joined
May 7, 2009
Messages
19,245
all report is on their Own window:

DoCmd.OpenReport "reportname1"
DoCmd.OpenReport "reportname2"
DoCmd.OpenReport "reportname3"
etc.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:20
Joined
Aug 30, 2003
Messages
36,125
Just add a second OpenReport with a different report specified.
 

Nyan Win

New member
Local time
Today, 22:50
Joined
Jun 19, 2020
Messages
8
all report is on their Own window:

DoCmd.OpenReport "reportname1"
DoCmd.OpenReport "reportname2"
DoCmd.OpenReport "reportname3"
etc.
Thanks I just wrote like that, But the code " "Township_Code=" & Me.txtTsp_Pcode " needed for each report and message asks "Enter parameter value" for Township code for each reports. If I want to open 10 reports, I have to reply Township code 10 times. It is tedious. I want to type Township code one time to appear for all reports. Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:20
Joined
Aug 30, 2003
Messages
36,125
If you're getting prompted, either the field name is spelled wrong or that field isn't in the record source of the other report(s).
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:20
Joined
May 7, 2009
Messages
19,245
I think what you need is multiple Township_code on a report, not multiple report.
instead of Combobox on your Form, replace it with Multi-select Listbox.
 

Nyan Win

New member
Local time
Today, 22:50
Joined
Jun 19, 2020
Messages
8
I think what you need is multiple Township_code on a report, not multiple report.
instead of Combobox on your Form, replace it with Multi-select Listbox.
No, I want to open the different (10)Access reports just after choosing a specific Township code.
 

Users who are viewing this thread

Top Bottom