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,

Do While Not rs.EOF

box.AddItem rs("Name")