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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Through Queries on the Fly

Status
Not open for further replies.

TomPose

Technical User
Dec 2, 2002
25
0
0
US
I am trying to make a pass through querie on the fly. I want to select a series of variable by either drop down box or typing in the filter in an input box and then make the SQL string that defines the pass through.

The following works to some extent. But, when I open it, it will not "PassThrough" how do i make a pass through where I can select any input as a criteria?

In the properties box of a previously set up Working PasThrough, the "ODBC Connect Str" is formated as : ODBC;DSN=Title;SERVER=servername;pwd=password and the code is the same format that is generated here with this code - (just the pass through issue is sticking)


Using:
Private Sub Command1_Click()
Dim dbs As Database, qdf As QueryDef, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT DISTINCT table1.no, table1.name " & _
"FROM d_base.table1 " & _
"WHERE table1.no= '" & "EnterNumberHere" & "' "
Set qdf = dbs.CreateQueryDef("TestQry", strSQL)



Any help is greatly appreciated.
 
Yes,

I want the "EnterNumberHere" to represent user input. I know that when running a regular query it will work, don't know if it would work in a pass through so if a variable would be better suited I would need to know how to get the input into the variable first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top