Combo Box populated with values from table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Apon entering a particular form, I'm trying to have the first Combo Box field
populated with values from a particular table.
I'm unclear on private and public subs, but I'll check into that after this.
If someone could provide a little direction in this learning project, thanks.

Been trying this on formload. Combo Box comes up blank..

Private Sub Form_Load()
Requery_cboDataType
End Sub


Private Sub Requery_cboDataType() 'Requery Main Form cboDataType
Dim strDataType
strDataType = "SELECT tblDataType.TypeID, tblDataType.typename " & _
"FROM tblDataType" & _
"ORDER BY tblDataType.typename;"
Me.cboDataType.value = strDataType
End Sub
 
Apon entering a particular form, I'm trying to have the first Combo Box field
populated with values from a particular table.
I'm unclear on private and public subs, but I'll check into that after this.
If someone could provide a little direction in this learning project, thanks.

Been trying this on formload. Combo Box comes up blank..

Private Sub Form_Load()
Requery_cboDataType
End Sub

Private Sub Requery_cboDataType() 'Requery Main Form cboDataType
Dim strDataType
strDataType = "SELECT tblDataType.TypeID, tblDataType.typename " & _
"FROM tblDataType" & _
"ORDER BY tblDataType.typename;"
Me.cboDataType.value = strDataType
End Sub
It's the Combo Rowsource property you want to set.
Me.cboDataType.RowSource = strDataType

After you select one of the items in the box, then that becomes it's
Value.
 
Thank you. I also forgot a space at the end of my one line before the quote.
"FROM tblDataType " & _

Works like a charm now
 
Back
Top