|
-
July 18th, 2001, 07:07 PM
#1
ADO Compile Error
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]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|