pass-through-queries

J

Jason

Hi,

Can someone help me on my way to use dynamic parameters in a
pass-through-query in access.

I've some forms which are referenced in jet queries and need to be
referenced in pass-through-queries. I tried to use the same approach with
queries, but it didn't worked.

If someone knows an anwser to this, i'd be very glad.

Thnx
 
A

Andi Mayer

Hi,

Can someone help me on my way to use dynamic parameters in a
pass-through-query in access.

I've some forms which are referenced in jet queries and need to be
referenced in pass-through-queries. I tried to use the same approach with
queries, but it didn't worked.

If someone knows an anwser to this, i'd be very glad.
Do you want us to write a help File on pass-through-queries for you?

give an example then we can show you (hopefully) where the problem is


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
D

Douglas J. Steele

You have to dynamically modify the SQL.

For instance, if you want to pick up the value that's contained in
txtSurname on your form for use in your pass-through query, you'd need to
add code along the following lines:

Dim qdfCurr As DAO.QueryDef
Dim strSQL as String

strSQL = "SELECT Field1, Field2 FROM MyTable " & _
"WHERE Surname = '" & Me.txtSurname & "'"

Set qdfCurr = CurrentDb().Queries("MyPassThroughQuery")
qdfCurr.SQL = strSQL
 
E

Ezekiël

Hello Douglas,

I've a similar question. How about passing the variable to a stored
procedure?
 
R

Rick Brandt

Ezekiël said:
Hello Douglas,

I've a similar question. How about passing the variable to a stored
procedure?

Same thing. You create (in code) the SQL statement that would constitute a
valid call to the Stored Procedure including the values to be passed as
parameters. Then you stuff that into the SQL property of a stored QueryDef and
execute it.
 

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