Quote:
Originally posted by razzaj:
so the unsrecognised error disapeared but now i have another one : "Type mismatch"
so i thought maybe there is an error in the code so there i am pasting the code , hoping that anyone can help :
Dim oDB As Database
Dim oRs As Recordset
Dim addline As ListItem
'Open your Database
Set oDB = Workspaces(0).OpenDatabase(App.Path & "\file.mdb")
'Select the Records You Want in the Listbox, In This Example, the LastName of all Employees
Set oRs = oDB.OpenRecordset("Select membername FROM Memberlist", dbOpenForwardOnly)
While Not oRs.EOF
'Step through the Recordset adding the "LastName" Field of Each Record to the Listbox
Set addline = ListView1.ListItems.Add(, , oRs("membername"))
addline.SubItems(1) = oRs("memberlastname")
oRs.MoveNext
Wend
One error that I see in your code is that you never move to the first record of oRs. You should have the above code enclosed in this IF statement: