Help display unbound combos

F

Fjordur

Hi,
I have a form with 3 unbound combos that lets the user filter data. The
combos RowSourceType = Value List, with 3 values, empty string with label
"don't care", -1 with label "yes", 0 with label "no".
The update event of the combo calls the following code:
Public Sub requeryThisForm()
s = CurrentDb.QueryDefs("MyBasicSelectQuery").SQL
If Not IsNull([ComboName]) Then
' modify s according to the value of the combos...
Me.RecordSource = s & ";"
End Sub

This works fine for filtering the data BUT the combos don't display the
chosen value properly. Sometimes they stay empty when I choose yes no; they
always stay mpty when i choose "don't care". I guess it has something to do
with the requery that's triggered when I modify the RecordSource .
How do I get the combos to display the chosen option? Thanks.
 
F

Fjordur

Fjordur said:
Hi,
I have a form with 3 unbound combos that lets the user filter data. The
combos RowSourceType = Value List, with 3 values, empty string with label
"don't care", -1 with label "yes", 0 with label "no".
The update event of the combo calls the following code:
Public Sub requeryThisForm()
s = CurrentDb.QueryDefs("MyBasicSelectQuery").SQL
If Not IsNull([ComboName]) Then
' modify s according to the value of the combos...
Me.RecordSource = s & ";"
End Sub

This works fine for filtering the data BUT the combos don't display the
chosen value properly. Sometimes they stay empty when I choose yes no; they
always stay mpty when i choose "don't care". I guess it has something to do
with the requery that's triggered when I modify the RecordSource .
How do I get the combos to display the chosen option? Thanks.
FWIW, I found that when a combo is empty, just clicking in it display its
value.
 
G

Guest

If your combo boxes are unbound, requerying the form's recordset will have no
effect on them. You will either have to populate them with code or, if there
is another control on you form that contains the value for the combo, you can
assign the combo's control source property to that control.

Fjordur said:
Fjordur said:
Hi,
I have a form with 3 unbound combos that lets the user filter data. The
combos RowSourceType = Value List, with 3 values, empty string with label
"don't care", -1 with label "yes", 0 with label "no".
The update event of the combo calls the following code:
Public Sub requeryThisForm()
s = CurrentDb.QueryDefs("MyBasicSelectQuery").SQL
If Not IsNull([ComboName]) Then
' modify s according to the value of the combos...
Me.RecordSource = s & ";"
End Sub

This works fine for filtering the data BUT the combos don't display the
chosen value properly. Sometimes they stay empty when I choose yes no; they
always stay mpty when i choose "don't care". I guess it has something to do
with the requery that's triggered when I modify the RecordSource .
How do I get the combos to display the chosen option? Thanks.
FWIW, I found that when a combo is empty, just clicking in it display its
value.
 

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