View Full Version : parameters / stored procedures


qwertyjjj
08-25-2006, 03:53 AM
I come from a SQL Server background and am very familiar with store dprocedures and input parameteres.

Is there a way to use a similar method in Access. or example, passing parameters from a button on a form to a query, which can change depending on the input parameter? If so, how ?

Also, how much scope do you have in this for running SQL IF statements and such in the query? It seems that many Access queris can only have one statement at a time.

KenHigg
08-25-2006, 04:00 AM
Qwert - Look at post 2 and maybe 13 in the thread linked below to get an idea of how to do some of this...

http://www.access-programmers.co.uk/forums/showthread.php?t=99777

qwertyjjj
08-29-2006, 01:38 AM
Thanks.
So, you pretty much have to do it with VBA code? There's no way to pass parameters to queries in Access as you would with stored procdures in SQL server?

qwertyjjj
08-30-2006, 02:38 AM
? ........

KenHigg
08-31-2006, 04:06 PM
I would tend to think of vba code as a sort of tsql. So you could save a sql statement in a function and pass the param there and insert it into a sql statemnet you build on the fly in the function... Make sense? I'm not aware of a way of calling a stored query by name and passing it a param...

pbaldy
08-31-2006, 06:52 PM
Are you looking for something like:

WHERE FieldName = Forms!FormName.ControlName

where each time the query is run it will look to that form control for the criteria?

qwertyjjj
09-04-2006, 03:03 AM
More or less, yeah.

pbaldy
09-04-2006, 08:24 AM
I guess then there you have it.