PDA

View Full Version : Solved: Populate combo box with Record Set in Access 2003



ganesh3084
06-20-2011, 01:39 AM
Hi
Im using a Combo box in my form which is used to populate values from a Table. I have used the following codes.
1. <Code>
Set db = CurrentDb()
Dim Lrs As DAO.Recordset, lsql As String
lsql = "select DeptName from Department"
Set Lrs = db.OpenRecordset(lsql)
While Not Lrs.EOF
Me.cmbDept.AddItem Lrs.Fields("DeptName")
Lrs.MoveNext

Wend

</Code>

Im Getting The following error when i execute:
"The RowSourceType Property Must be set to 'Value List' to use this method"

What i need to do
Plz Suggest

HiTechCoach
06-20-2011, 10:28 PM
On the Property sheet go to the Tab for DAT for eh Combo Box and set to value list

(Credits: Screenshot created with TechSmith's SnagIt)