Dynamic Combobox

  • Thread starter Thread starter alexcn
  • Start date Start date
A

alexcn

Hi Everyone,

I have a continuous subform that has three combo box controls of which
two need to have dynamic rowsources based on the value of the third
combo. I have adopted the stance of having parameter driven SP to
feed both combo controls, and have tried setting the value of the
rowsource property in code as part of the Form Open AND Form Load
events.

While this works correctly, each combo has the same rowsource whereas
I need records combobox pair to be independant based on the value of
the third control in the respective current record. Is there a way to
pass the value of the criteria combobox to the SP for the remaining
two for each record in a continuous form?

Many thanks!
 
On a continuous form, each ComboBox for each record must have the same
rowsource because the DataRepeater Control of Access is limited in its
fonctionality.; you cannot directly achieve what you want.

However, you can use the OnCurrent event to reset the rowsource of your
combobox each time the user moves the focus on another record; but this will
considerably slow down your interface. A better idea might be to change the
rowsource only when the user open a combobox, but it's still again a patch
that might not be usefull because of delay required to make the request to
the server. The only viable option in my mind would be to locally store all
the data in an independant recordset and use this recordset to build the
record source as a string by first applying a filter (or creating a cloned
recordset) and then using the GetString(, , ",", ",") function of the
recordset. (I'm not sure about this filter thing, as it is a long time
since the last time that I done it. However, you can easily make the
appropriate corrections if necessary. You can also use a VBA function as the
RowSource Type to drive the filling of the combobox after a requery but this
is a rather complicated method.)

S. L.
 
Back
Top