Combo boxes and stored procedures

  • Thread starter Thread starter Joe
  • Start date Start date
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
 
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.
 
Back
Top