I am trying to populate my listbox from an access database and I seem to get this compile error whenever I go to preview it:

Compile error:

user-defined type not defined

Here is an example of the code I am using:


'Connecting to an Access Database using ADO
option Explicit
Dim cnn as ADODB.Connection
Dim rs as ADODB.Recordset

private Sub Form_Load()
set cnn = new ADODB.Connection
set rs = new ADODB.Recordset

' Open the database connection and recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb;" & _
"Persist Security Info=false"
rs.Open "Select * from Customers", cnn, adOpenStatic, adLockOptimistic

' Place values in the comboBox control
Do While rs.EOF = false
Combo1.AddItem rs!CompanyName
rs.MoveNext
Loop
End Sub




Any ideas as to why I may be getting this error?


Timothy H. Schilbach
Alpha Omega Design Inc.
[email protected]