Reputation: 597
I am trying to fill up the row source of a bounded combo box programmatically in Ms-Access. However, it does not show any of the numbers when I view the form.
Private Sub Form_Open(Cancel As Integer)
Me.cmbErrorType.RowSourceType = "Value List"
Me.cmbErrorType.RowSource = "1;2;3;4;5;6"
End Sub
When the form opens, I click on combo box, and it shows nothing in the drop down menu.
As far as I know, row source is used to build up the items in the combo box than why is this happening ?
Upvotes: 1
Views: 1744
Reputation: 642
As far as I can understand the situation, you are using the lookup property of a field in a table with display control as combo box.
If you bound the field with Display Control
as Combo Box
to a Form.ComboBox
, it somehow overrides the rowsource
property when you try to show the drop down list. To show the list, you either need to change the display control in your Field Properties
[Database].TableDefs("TableName").Fields("Field").Properties("DisplayControl") = acTextBox
or
Keep the DisplayControl property to textbox when designing the table in the first place.
or change the Field Row
Source` property
[Database].TableDefs("TableName").Fields("Field").Properties("RowSource") = "1;2;3;4;5;6"
Upvotes: 1