Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Pass through query

Author  Topic 

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-02-21 : 10:06:40
I have a pass through query that executes a Stored Procedure - ok great. What i need to do is pass a parameter to the stored procedure via the pass through query. e.g.

Dim strSQL As String

strSQL = "qry_QairePlcList '" & current_UID() & "'"
Me.cbo_PlcList.RowSource = strSQL

the current_UID() function returns a 7 character string.

My pass through query is....

execute usp_QairePlcList_sel

the usp_QairePlcList_sel stored procedure also needs the 7 character string mentioned earlier and this is what i seem to be having problems passing to the SP via the passthrough query.

I want to assign the passthrough query as the rowsource of a combo box.

Have i got the syntax wrong ? Is there another way to do it ?

Using SQL7, Access97



Edited by - KnooKie on 02/21/2002 10:07:51

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-02-21 : 12:48:15
Managed to do it using a post of robvolk's i found, it went something like this....


Dim db As Database, rsPlcList As Recordset, qdfPlcList As QueryDef
Dim strSQL As String

Set db = CurrentDb

Set qdfPlcList = db.QueryDefs("qry_QairePlcList")
strSQL = "EXECUTE usp_QairePlcList_sel " & gsUID
qdfPlcList.sql = strSQL
Me.cbo_PlcList.RowSource = "qry_QairePlcList"
Set qdfPlcList = Nothing

the query is a passthrough although its SQL is unimportant as it gets set in the code anyway. But it needs to exist.


Is answering my own questions a sign of madness ??


Edited by - KnooKie on 02/21/2002 12:54:48

Edited by - knookie on 02/22/2002 05:13:51
Go to Top of Page
   

- Advertisement -