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 code snippet at the bottom 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)
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.
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.
The code snippet at the bottom 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)
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.
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.