Setting RowSource properties...

  • Thread starter Thread starter T.
  • Start date Start date
T

T.

Hello everyone,

I am just wondering if anyone can answer a simple question about the
RowSource property of a combo box. As of right now I have the RowSource
set to the result of a query. This is going to be the correct data 95% of
the time. The other 5% of the time is when there is a certain value in one
of my text boxes. If that value is true then I need the rowsource to do
something slightly different. I code that evaluates for this field already
in my Form_Load() event, if I reassign the RowSource through VBA code in
this module will it override the query that I have set in the property box
for the control??

TIA,

T.
 
T. said:
Hello everyone,

I am just wondering if anyone can answer a simple question about the
RowSource property of a combo box. As of right now I have the
RowSource set to the result of a query. This is going to be the
correct data 95% of the time. The other 5% of the time is when there
is a certain value in one of my text boxes. If that value is true
then I need the rowsource to do something slightly different. I code
that evaluates for this field already in my Form_Load() event, if I
reassign the RowSource through VBA code in this module will it
override the query that I have set in the property box for the
control??

You mean, along the lines of

Private Sub Form_Load()

If Me.txtSomeTextBox = 'Some Value' Then
Me.cboMyComboBox.RowSource = "SELECT foo FROM Bar;"
End If

End If

? Yes, that will override whatever rowsource was in the combo box's
property sheet. You can do that at any time, not just in the form's
Load event.
 
Back
Top