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

Passing a value into a stored procedure in an accessXP project??

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
I am trying to pass a value into a stored procedure, from a form using the standard access referencing method:

i.e
=[Forms]![SelectCriteria]![lstPriority]

It does not seem to understand this though, & updates the underlying fields to '[Forms]![SelectCriteria]![lstPriority]', rather than appending the corresponding value.

Any ideas?? James Goodman
j.goodman00@btinternet.com
 
I'm pretty sure that you can't use variables in a Pass-Thru query. You'll have to redefine the query from somewhere (ie: a form) before you run it with the variable hard coded in place. Here's some code to change a query definition:

Dim stSQL As String
Dim loqd As QueryDef

Set loqd = CurrentDb.QueryDefs("qselPriorities")
stSQL = "SELECT Blah FROM Blah WHERE x = 'Blah'"
loqd.SQL = stSQL
loqd.Close

HTH
Joe Miller
joe.miller@flotech.net
 
I'm pretty sure that you can't use variables in a Pass-Thru query. You'll have to redefine the query from somewhere (ie: a form) before you run it with the variable hard coded in place. Here's some code to change a query definition:

Dim stSQL As String
Dim loqd As QueryDef

Set loqd = CurrentDb.QueryDefs("MyQueryName")
stSQL = "SELECT Blah FROM Blah WHERE x = 'Blah'"
loqd.SQL = stSQL
loqd.Close

HTH
Joe Miller
joe.miller@flotech.net
 
I see where you are coming from, but it must be possible the other way, because that is seemingly a core part of standard access databases. I can get SQL to ask for a parameter value, but it will not look into a form for it..

From what I understand, a stored procedure can contain proper programming, which suggests you could actually attain the value this way & then pass it into the procedure directly. However this seems like a very complicated way to achieve something which should be very simple.....

James Goodman
j.goodman00@btinternet.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top