-
Type mismatch error with declaration
Hi!
I was trying to retrieve database's info into listbox. First, i created a
form called "parent". In form "parent", i added a property called "getdb"
to get the database info. Second, i created function "AddCompName" in module
and try to retrieve database's info into the other form's listbox. the program
listed below. I was confused by the declaration in the function because i
wouldn't declare rs as recordset because it would give me a type mismatch
error. Without the declaration, the program ran correctly. Would someone
tell me why?
Public Property Get getdb() As Database
Set getdb = db
'Debug.Print "getdb="; getdb.Name
End Property
Public Function AddCompName(box As ListBox) As Integer
dim rs as recordset
Set rs = parent.getdb.OpenRecordset(sqlCompName, dbOpenDynaset, dbInconsistent,
dbOptimistic)
Do While Not rs.EOF
box.AddItem rs("Name")
rs.MoveNext
Loop
Thanks!
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|