Input Parameters Property For Combo's?

  • Thread starter Thread starter Res
  • Start date Start date
R

Res

I have two forms in my project. When the first form is opened you use the
record selectors to choose a record. You click a command button and another
form is opened that contains several combo boxes. These combo boxes need to
be populated via a Stored Procedure / User Defined Function but using a
value from the first form. The Combo box control does not have an Input
Parameter property.

How should I proceed? I ideally want to use Access XP / SQL Server 2000
functionality and not Access VBA code if it can be avoided but if VBA is the
only answer thats fine.

Thanks
 
You want to create the View or Stored Procedure with the data you need. In
the WHERE statement use a variable @variable. In the Input Property of the
second form should have the @variable type=[form]![formname]![combobox]. If
there are more than one columns in the combo box add .Column(column#). The
column numbers start at 0. I hope this helps.
 
Res,

You do know that stored procs or UDFS, when used as record source for
combobox, will magically have any parameters passed into them whose name
equals that of the combo boxes's parent form's recordset or access field?

This does NOT directly help you, but...

You could contrive to give your 2nd form a hidden field whose name matches
that of the SP/UDF's parameter. Then, have it set by the script behind the
1st form's command button which opens the 2nd form in the first place. Have
this script also requery the combo boxes.

It should work.

You could also bypass the hidden field altogether, and instead (VB here we
go) hack the combo boxes recordset to a new one created from a command whose
parameters you explicitly set. This can be done, but is a little hairy.
Write back if you want to try this route, i'll send some snippets...

-Malcolm Cook
 
Back
Top