G
Guest
Hi,
I have an unbound form that's embedded as a subform in another form.
The subform's recordset is set dynamically when a record is selected
in the main form. The subform is set to Continuous. The header has a
set of text boxes and comboboxes used to edit the data in whichever
record is selected or to enter new records. I populate the rowsources
in the header comboboxes with stored procs with two columns, a key
column and a description. I have the following settings in the
combobox:
BoundColumn: 1 (key field)
ColumnWidths: 1";1"
ColumnCount: 2
ControlSource: I never put anything here; always blank.
When the recordset of the subform has pre-existing records, everything
works as expected. However, when the subform's
Recordset.Recordcount=0, making a selection in one of the comboboxes
doesn't work as expected. The value in the key column comes through in
the control's value property in code, but the value is not displayed.
When I change the BoundColumn property to "2", the value in column 1
is displayed, but the Value property of the combobox picks up the
value in column 2.
I have found that if I put the following code in the routing that
fills the recordset, it seems to work:
If Me.Recordset.RecordCount = 0 Then
Set .Recordset = Nothing
End If
I consider this a reasonable workaround, but still cannot figure out
why an unbound combobox is affected by a recordset's recordcount. Also
a little peaved that this bug/feature cost me >8 hours of my time.
Any ideas about what is going on here would be helpful.
I have an unbound form that's embedded as a subform in another form.
The subform's recordset is set dynamically when a record is selected
in the main form. The subform is set to Continuous. The header has a
set of text boxes and comboboxes used to edit the data in whichever
record is selected or to enter new records. I populate the rowsources
in the header comboboxes with stored procs with two columns, a key
column and a description. I have the following settings in the
combobox:
BoundColumn: 1 (key field)
ColumnWidths: 1";1"
ColumnCount: 2
ControlSource: I never put anything here; always blank.
When the recordset of the subform has pre-existing records, everything
works as expected. However, when the subform's
Recordset.Recordcount=0, making a selection in one of the comboboxes
doesn't work as expected. The value in the key column comes through in
the control's value property in code, but the value is not displayed.
When I change the BoundColumn property to "2", the value in column 1
is displayed, but the Value property of the combobox picks up the
value in column 2.
I have found that if I put the following code in the routing that
fills the recordset, it seems to work:
If Me.Recordset.RecordCount = 0 Then
Set .Recordset = Nothing
End If
I consider this a reasonable workaround, but still cannot figure out
why an unbound combobox is affected by a recordset's recordcount. Also
a little peaved that this bug/feature cost me >8 hours of my time.
Any ideas about what is going on here would be helpful.