Report from multiple queries

  • Thread starter PhilT via AccessMonster.com
  • Start date
P

PhilT via AccessMonster.com

I need help to run a report. I have two separate queries; one is
qryInternalData and qryExternalData. These queries cannot be mix together.
Right now, I have two same rptReportData format Record Source from the
qryInternalData and qryExternalData.

Since both InternalData and ExternalData are using the same report format,
how can I tell Access to use certain query for Record Source. For example, I
like to have a macro to pick qryExternalData or qryInternalData as Record
Resource for rptReportData.

Very appreciate for your help.
 
B

Bamar

I need help to run a report. I have two separate queries; one is
qryInternalData and qryExternalData. These queries cannot be mix together.
Right now, I have two same rptReportData format Record Source from the
qryInternalData and qryExternalData.

Since both InternalData and ExternalData are using the same report format,
how can I tell Access to use certain query for Record Source. For example, I
like to have a macro to pick qryExternalData or qryInternalData as Record
Resource for rptReportData.

Very appreciate for your help.

Yes.

First create another simple form named frmMySelection, which is a
dialog form to choose record soruce of your report rptReportData

In this form,
1. create a combo box with properties..
name= combo1
record source= 1;2
record source type = Value List
limit to list = yes
default value = 1

2. create a command button named cmd1
set on click event as follow.
Private Sub cmd1_Click()
DoCmd.OpenReport "rptReportData", acViewPreview
End Sub

3. Then on Report rptReportData code as follow for open event.

Private Sub Report_Open(Cancel As Integer)
If Forms("frmMySelection")!Combo1.Value = 1 Then
Msgbox "This is qryExternalData report"
Me.RecordSource = "qryExternalData"
Else
Msgbox "This is qryInternalData report"
Me.RecordSource = "qryInternalData "
End If
End Sub

Whenever you choose your option and click from Form frmMySelection,
you will have what you want.

Rgds,
Bamar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top