Compile Error on .Last Modified

L

LisaB

I have imported the following code into my MS Access 2000 database and get a
compile error.
This code works in another database.
When trying to compile the .LastModified is highlighted when the error
message appears

also

I have simular code where the .Edit gets highlighted when the error message
appears



Microsoft Visual Basic - Compile Error - Method or data member not
found
----------------------------------
Set TheDB = CurrentDb
Set SourceRS = TheDB.OpenRecordset("tblOpened", dbOpenDynaset)


With SourceRS
.Edit
!Opened = !Opened + 1
.Update
.Bookmark = .LastModified
End With


SourceRS.Close
 
C

Chris Nebinger

The problem is probably with your references. Go into
Tools-> references, and add one to the DAO 3.6 object
library. Then, everywhere you see

Dim rs As Recordset

You'll have to:

Dim rs As ADODB.Recordset
Or
Dim rs As DAO.Recordset.


Otherwise, just change the Dim statement in your existing
code to:

Dim SourceRS As Object


Chris Nebinger
 
D

Dirk Goldgar

LisaB said:
I have imported the following code into my MS Access 2000 database
and get a compile error.
This code works in another database.
When trying to compile the .LastModified is highlighted when the error
message appears

also

I have simular code where the .Edit gets highlighted when the error
message appears



Microsoft Visual Basic - Compile Error - Method or data member
not found
----------------------------------
Set TheDB = CurrentDb
Set SourceRS = TheDB.OpenRecordset("tblOpened", dbOpenDynaset)


With SourceRS
.Edit
!Opened = !Opened + 1
.Update
.Bookmark = .LastModified
End With


SourceRS.Close

See my answer to your subsequent question on the type mismatch error.
 

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

Top