Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Query Before Report

Status
Not open for further replies.

JavaToPerlNowVB

Programmer
Jul 14, 2005
84
US
Hi Everyone

I have this code in a form, and I want to run few queries before the report grab data from those queries. I am not sure, if i should do docmd.openquery "queryName" but this way the query will open for the user and i don't want that to happen.
Code:
Private Sub workDonePoles_Click()
On Error GoTo Err_workDonePoles_Click
Dim stDocName As String
Dim stLinkCriteria As String

'I want to run the query here

DoCmd.Echo True, "Preparing Report...Please Wait"
stDocName = "completedWorkPole"
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

Exit_workDonePoles_Click:
    Exit Sub

Err_workDonePoles_Click:
    MsgBox Err.Description
    Resume Exit_workDonePoles_Click
End Sub

Thanks for all the help -
 
Is the report based on the query? If so, just set the report's record source to the query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top