debug error on '.edit' statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm fairly new at VBA programming. I have run into a snag.

I want to use code to save edited data from unbound text boxes. The
following code fragment causes an error when I try to compile the module.

Error:
"Compile Error, Method or data member not found"

Code:
With SdrInfo
'
.Edit <----------- Debugger highlights this line
 
Hi,

Sorry, SdrInfo is a recordset. I open it with

Set db = CurrentDb()
Set SdrInfo = db.OpenRecordset("tblSdrInspectionInfo", dbOpenDynaset)
 
I should also add that SdrInfo references a table residing on the
back end of this database
 
Hi,

Thanks for the tip. How does one know if a database is an ADO or DAO.
I still find the differeneces between these 2 confusing.
 
Your code should be something like:
Dim db as DAO.Database
Dim SdrInfo As DAO.Recordset
Set db = CurrentDb()
Set SdrInfo = db.OpenRecordset("tblSdrInspectionInfo", dbOpenDynaset)

This code explicitly uses the DAO library which has been around in Access
for more years than ADO. DAO IMHO works best for Access tables.
 
The OpenRecordset method of the DAO Database object will always return a DAO
Recordset, so if SdrInfo was anything other than a DAO Recordset, I'd expect
a Type Mismatch error on the line that calls OpenRecordset. I think you may
need to post more of the code before we can see what the problem is.
 
Brendan Reynolds said:
The OpenRecordset method of the DAO Database object will always
return a DAO Recordset, so if SdrInfo was anything other than a DAO
Recordset, I'd expect a Type Mismatch error on the line that calls
OpenRecordset. I think you may need to post more of the code before
we can see what the problem is.

I don't think the "type mismatch" error will be raised until run time.
The "method or data member not found" error will be raised at compile
time, which is what CityGuy is reporting.
 
Adding the "DAO." fixed the problem. Thanks for the help.
Where can I get some good reference material on the differences
between the ADO and DAO?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top