Combo boxes and stored procedures

J

Joe

I have a form base on a stored procedure where the records are filtered on
three unbound combo boxes (cboAddress, cboDirection, and cboStreetname)
through the Input Parameters property.

cboAddress is based on a view. cboDirection and cboStreetName are based on
stored procedures with parameter variables. How do I pass the proper
parameter values to the stored procedures? cboDirection should be filtered
on the value of cboAddress, and cboStreetName should be filtered on the
values of both cboAddress and cboDirection.

I've poured through my two Access/SQL Server books, the help file, and the
knowledgebase to no avail (one KB article had sample code that didn't work).

Thanks,
Joe
 
B

Bryan

From archives, both examples work, I prefer the first.

First solution: give the parameter in the stored
procedure the same name asthe control, but preceded
with '@'. So in your example the parameter name would be
@cboCountryNo. According to the book, this is
undocumented, but works.

Second solution: use EXEC. You can use EXEC to execute
stored procedures while also passing parameters, e.g.
cboStateNo.RowSource = "EXEC SPName " & cboCountryNo.Value

The book is Microsoft Access Projects with Microsoft SQL
Server, authors Ralf Albrecht and Natascha Nicol,
published by Microsoft Press, ISBN


'0-7356-1002-9.
 

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