requery of cbo based on form record source

J

John Baker

I would like to be able to reset a combo box rowsource to reflect the
changes in the records being seen on the form. I change the form
recordsource and then would like to have the rowsource of the combo box to
be the same.

I am trying to use the following code without success:

Me.cboFindOperatorName.RowSource = Me.Form.RecordSource


Also I was trying to use a quick watch to see what the actual string value
of the form rowsource is when I change it but can't seem to be able to do
this.

Any help greatly appreciated.
John B
 
B

Brendan Reynolds

This works for me. Note the last line, which requerys the combo box.

Private Sub cmdTest_Click()

If Me.RecordSource = "SELECT * FROM tblTest ORDER BY TestID ASC" Then
Me.RecordSource = "SELECT * FROM tblTest ORDER BY TestID DESC"
Else
Me.RecordSource = "SELECT * FROM tblTest ORDER BY TestID ASC"
End If
Me.cboTest.RowSource = Me.RecordSource
Me.cboTest.Requery

End Sub
 

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