Combo Box

A

Armin

How do I add items to the combo box?I'm getting the
Err.Msg "Method or data member not found".Here is the code

Thanks in advance

Armin

Dim strPathWeb As String
Dim db As DAO.Database, rcd As DAO.Recordset, strSQL As
String



strPathWeb = DLookup("[LinkToCal]", "tblcominfo") 'LINK TO
WEB DB

Set db = DBEngine(0).OpenDatabase(strPathWeb)

strSQL = "SELECT * FROM wcal_location"

Set rcd = db.OpenRecordset(strSQL)
rcd.MoveFirst
Do While Not rcd.EOF
rcd.MoveNext
Me.cmbWhere.additem rcd!Location
Loop

rcd.Close
set db = nothing
 
G

Gerald Stanley

The simplest way to populate a combo box is to define the
rowSource e.g.

cmbWhere.RowSource = "SELECT location FROM wcal_Location"

You will also need to make sure that cmbWhere.RowSourceType
= "Table/Query"

Hope This Helps
Gerald Stanley MCSD
 
J

John Vinson

How do I add items to the combo box?I'm getting the
Err.Msg "Method or data member not found".Here is the code

Annoyingly enough, an Access Combo Box is a very different beast from
a Visual Basic combo box - with different properties and different
methods. There is no AddItem method, as you have discovered.

Instead, base your Combo box on a query pulling data from a table; to
add an item to the combo, add a record to that Table and requery the
combo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top