Hey peeps,
I need some guidance here. I have the following vba code in a On Click event:
Now, I want to run a query in the above case statment and display the results in the report. So for example, say Case 1 is true, I want to run a query(which I will add to the code) and display the records in "ReportOne". So something like this:
My question is how do I run the query and source the results in a report!
Thanks,
Ket
I need some guidance here. I have the following vba code in a On Click event:
Code:
Private Sub Command12_Click()
Dim intCountryID As Integer
intCountryID = DLookup("CountryID", "qryCompanyFilter", "[CompanyID] = " & Me.Text10)
Select Case intCountryID
Case 1
DoCmd.OpenReport "ReportOne", acViewPreview
Case 2
DoCmd.OpenReport "ReportThree", acViewPreview
Case 3
DoCmd.OpenReport "ReportTwo", acViewPreview
End Select
End Sub
Now, I want to run a query in the above case statment and display the results in the report. So for example, say Case 1 is true, I want to run a query(which I will add to the code) and display the records in "ReportOne". So something like this:
Code:
Case 1
mysql = "SELECT Countries"
mysql = mysql & " FROM qryFootballTournament"
mysql = mysql & " qryFootballTournament.Points =" & Me.Points
DoCmd.OpenReport "ReportOne", acViewPreview
Case 2
mysql = "SELECT Countries"
mysql = mysql & " FROM qryFootballTournamentTwo"
mysql = mysql & " qryFootballTournament.Points =" & Me.Points
DoCmd.OpenReport "ReportTwo", acViewPreview
Case 3
mysql = "SELECT Countries"
mysql = mysql & " FROM qryFootballTournamentThree"
mysql = mysql & " qryFootballTournament.Points =" & Me.Points
DoCmd.OpenReport "ReportThree", acViewPreview
My question is how do I run the query and source the results in a report!
Thanks,
Ket