Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populate combo box from external recordset 3

Status
Not open for further replies.

idono

Technical User
Jan 16, 2002
71
US
I am trying to populate a combo box on a form from an ADO recordset. Obviously, I'm not having much luck. It appears that the additem property does not exist for the control. I tried all of these and it says an object is required:

Forms!frmGroup.Group.ItemData(X).Add rst.Fields![m-user]

Forms!frmgroup.Controls("Group").Add rst.Fields![m-user]

Group.Object.Add rst.Fields("m-user")

With Me.Group
.ItemData(X).Additem rst.Fields![m-user]
End With

Any suggestions?

 
Hi!

For ordinary Access combos, the .AddItem method became available in version 2002.

Before that, one needs to concatinate the rowsource:

[tt]dim sRowS as String
do while not rst.eof
sRowS = sRowS & rst.Fields![m-user] & ";"
rst.movenext
loop
Me![Group].RowSource = sRowS[/tt]

Else the Me![Group].AddItem rst.Fields![m-user] should work on 2002

- typed not tested - Group might be a reserved word, try using [brackets] on it too

Roy-Vidar
 
You my friend, have been moved into the genius category. Thanks a bunch!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top