pass-through-query and stored procedure

J

Jason

Hi,

I've this function for passing values to stored procedures by using a
pass-through-query, but i can't manage to bind to a form's recordsource to
display the data.

Here's the code:

Public Sub SetSPArguments(ByVal strQueryName As String, ByVal strArguments
As String)
On Error GoTo Err_SetSPArguments

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSPCall As String

Set db = CurrentDb
Set qdf = db.QueryDefs(strQueryName)

strSPCall = qdf.SQL

strSPCall = Left(strSPCall, InStr(InStr(strSPCall, " ") + 1, strSPCall,
" "))

qdf.SQL = strSPCall & strArguments
qdf.Close

Exit_SetSPArguments:

Set db = Nothing
Set qdf = Nothing
Exit Sub
Err_SetSPArguments:

MsgBox Err.Description
Resume Exit_SetSPArguments
End Sub

Can someone help me with this?

Thnx
 
M

[MVP] S.Clark

Can you have the stp create a table, then use the table as the form's
recordsource?
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just paste the name of the pass-thru query into the form's RecordSource
property:

If you run your Sub from the same form:

SetSPArguments strQueryName , strArguments

Me.RecordSource = strQueryName
' Me.Requery ' -- don't need to do this since changing the RecordSource
automatically requeries the form.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQfls5YechKqOuFEgEQLs9ACg+Fx3OxUSKfRio4SOGT5Vf2ARxwwAoIpf
1vb1zv1rcGJqlQf0ISGozdpJ
=7Aro
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top