I have a user form with a combobox and I want to add items to the combo box from a SQL statement. Here is my code:
This does add the first item to the drop down list, but I need it to loop through ALL the records in rsData, and add them all. Any ideas on how to do this?
Software Training, Implementation, Programming and Support for Macola Progression, Macola ES, Synergy, and Crystal Reports. Check out our Macola tools:
Code:
[COLOR=#4E9A06]'Drop Down List SQL statement[/color]
mstSql = "SELECT DISTINCT user_def_fld_3 FROM imitmidx_sql WHERE user_def_fld_3 IS NOT NULL ORDER BY user_def_fld_3"
cmbColor.Clear [COLOR=#4E9A06]'clears the drop down list[/color]
rsData.Open mstSql, conData, adOpenDynamic, adLockOptimistic [COLOR=#4E9A06]'executes the SQL statement[/color]
With rsData
cmbColor.AddItem rsData.Fields("user_def_fld_3") [COLOR=#4E9A06]'adds the item to the drop down list[/color]
.MoveNext [COLOR=#4E9A06]'? was hoping this would loop through the record set, but it doesn't[/color]
End With
rsData.Close
This does add the first item to the drop down list, but I need it to loop through ALL the records in rsData, and add them all. Any ideas on how to do this?
Software Training, Implementation, Programming and Support for Macola Progression, Macola ES, Synergy, and Crystal Reports. Check out our Macola tools: