Passthrough query variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

on 12/10/04 Duane provided an answer for having a passthrough query run with
a variable:

You can modify the SQL property of the saved p-t query with code like:
Dim strSQL as String
strSQL = "Select Group From GroupTable where Group In ('" & var1 & "')"
Currentdb.QueryDefs("YourPTNameHere").SQL = strSQL

--

Could you please back up one step? Where does this code go? Can it just be
set at the beginning of a module to declare database properties? Do I have
to create a new function? If so, how would I call that function?

Is this a way to get a prompt to enter variables as the p-t starts up?

Thanks.
ann
 
Where do you set the value of var1? Assuming you have a form with
Text Box for the user to enter a Group value:
Name: txtGroup
Control Source:
Command button to open the report. Add code to the click button that
modifies the
Dim strSQL as String
strSQL = "Select Group From GroupTable where Group In ('" & Me.txtGroup &
"')"
Currentdb.QueryDefs("YourPTNameHere").SQL = strSQL
 
Back
Top