Reference problems in VBA

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have some simple code as below;

With tblCLA
.AddNew
.Update
.MoveLast
.Edit
![cust] = strCust
.Update
End With

I get the message 'compile error; Method or data member
not found' for the .Edit line. Anyone know why? I have
precisely the same references used by other access
databases and the .Edit function works fine in them.
 
If you are using Access 2000 or beyond.
It might be library reference.
Try to check when you are in VBA Editor, under "Tool"
and "Reference". Compare the one that works and the one
that doesn't. See what are you missing.
 
Steve,

If you have references to both DAO and ADO, and you don't explicitly dim
your recordset, Access will use the first one in the references list. To
make this work, move DAO above ADO in the refs list. An ADO recordset does
not have the edit method.

Also, it's a good idea to always dim recordsets explicitly like this:
dim rs as adobd.recordset or
dim rs as dao.recordset

HTH,
Josh

JL said:
If you are using Access 2000 or beyond.
It might be library reference.
Try to check when you are in VBA Editor, under "Tool"
and "Reference". Compare the one that works and the one
that doesn't. See what are you missing.
-----Original Message-----
I have some simple code as below;

With tblCLA
.AddNew
.Update
.MoveLast
.Edit
![cust] = strCust
.Update
End With

I get the message 'compile error; Method or data member
not found' for the .Edit line. Anyone know why? I have
precisely the same references used by other access
databases and the .Edit function works fine in them.


.
 
Back
Top