Compile error when editing record

  • Thread starter Thread starter Mike Kirros
  • Start date Start date
M

Mike Kirros

When I run the code listed below, I get the following
error on the line reading "tb1.Edit"

Compile error: Method or data member not found

It sounds like a references problem, but I can't figure
out what might be missing. I have the following references

Visual Basic for Applications
Microsoft Access 10.0 Object Library
Microsoft ActiveX Data Objects 2.5 Library
Microsoft DAO 3.6 Object Library
Microsoft Office 10.0 Object Library
Microsoft Visual Basic for Applications Extensibility 5.3

Here is the code (which I have used before and copied from
another application:

Private Sub Command0_Click()
Dim db1 As Database
Dim tb1 As Recordset
Dim intPos As Integer
Dim strAddress As String
Dim intTestAddress As Integer
On Error GoTo NextRecord

Set db1 = CurrentDb
Set tb1 = db1.OpenRecordset("tblActivistsWOID",
DB_OPEN_DYNASET)
tb1.MoveFirst
Do
intPos = 1
strAddress = tb1![Address]
Do Until Mid(strAddress, intPos, 1) = " "
intPos = intPos + 1
Loop
intTestAddress = CInt(Left(strAddress, intPos - 1))
tb1.Edit
tb1![Street_no] = Left(strAddress, intPos - 1)
tb1![Street_nm] = Mid(strAddress, intPos + 1)
tb1.Update
NextRecord:
tb1.MoveNext
If tb1.EOF Then Exit Do
Loop

End Sub
 
Mike said:
When I run the code listed below, I get the following
error on the line reading "tb1.Edit"

Compile error: Method or data member not found

Private Sub Command0_Click()
Dim db1 As Database
Dim tb1 As Recordset

Change this into DAO.recordset and see if that helps.
 
Back
Top