Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or data member not found

Status
Not open for further replies.

cravincreeks

Technical User
Jun 18, 2004
85
US
Hello all.

I developed a simple MS Access 2002 database (.mdb) with a few forms that have custom code. I initially used ADO 2.7 libraries. I sent it to a person in an entirely different department who is using Access 2000. She's repeatedly getting "Method or data member not found" when she attempts to use one of these forms with custom VBA code.

I made sure that she had all of the correct references set and she did. Then I rewrote all of the code that she will be using, which is really just subset of the entire project, using DAO. I explicitly declared all DAO variables as such (eg, Dim rsParks as DAO.Recordset). I also commented out any procedure that she didn't need that contained some ADO code - including variable declarations. Currently, there are no references to ADO in her copy of the entire database project. I also had her move the DAO reference up above the ADO reference.

Here is the code
Code:
    Dim rsPark As DAO.Recordset, db As DAO.Database
    Set db = CurrentDb
    Call ClearList(lstResults) 'custom function
    txtSearch.SetFocus
    sSQL = "SELECT tParks.NAME_LONG FROM tParks WHERE tParks.NAME_LONG Like '*" & txtSearch.Text & "*';"
    Set rsPark = db.OpenRecordset(sSQL, dbOpenSnapshot, dbReadOnly)
    Debug.Print sSQL
     If rsPark.RecordCount = 0 Then Exit Sub
     rsPark.MoveFirst
     Do Until rsPark.EOF
        
        lstResults.AddItem (rsPark!NAME_LONG)
        rsPark.MoveNext
     Loop
This code functions perfectly on my computer, but does not on hers. It's bombing on lstResults.AddItem (rsPark!NAME_LONG) that is inside the recordset loop - that row is highlighted when she types text into a text box and triggers the code.

She's using Access 2000 on Windows 2000 and I'm using Access 2002 on Windows 2000. Somebody in her office opened the database using Access 2002, converted it to Access 2000 and sent it to her. The code still didn't work.

I'm at a loss. Please help!



 
Access 2000 lacks the AddItem method of theListBox object ...
 
Exactly as PHV said!

In order to keep your code generic for all versions,
you may want to trap the error, and use SOMETHING like
the following in the error handler...?

strRowSource = lstResults.Rowsource & ";" & rsPark!NAME_LONG
lstResults.Rowsource = strRowSource
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top