Did not have this error yesterday - Run-time error '3219" Invalid operation

I am developing an Access database in 2007 with a FE/BE configuration. I implemented a number of UI changes yesterday that worked just fine.... yesterday...

Today, in testing the very same UI I am receiving "Run-time error '3219" Invalid operation" on more than one line of code, and UIs that I did not touch yesterday. The line (>>>) below is one example, which I DID NOT CHANGE TODAY.

Thanks in advance.

Private Sub cmdAssignNo_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset, rst1 As DAO.Recordset
        Set db = CurrentDb()
        Set rst = db.OpenRecordset("assign Plan No", dbOpenTable)
>>>        Set rst1 = db.OpenRecordset("tblPlan", dbOpenTable, dbPessimistic)

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
Hello Destiny947,

Check your references in the VB Editor, and see if any are listed as missing.


Rey Obrero (Capricorn1)Commented:
this line does not have the correct argument

Set rst1 = db.OpenRecordset("tblPlan", dbOpenTable, dbPessimistic)


                 OpenRecordset (source, type, options, lockedits)

dbPessimistic is one of the lockedits not options


Set rst1 = db.OpenRecordset("tblPlan", dbOpenTable, dbPessimistic)


Set rst1 = db.OpenRecordset("tblPlan", dbOpenTable,, dbPessimistic)
Destiny947Author Commented:
Hi Matthew and Capricorn1.

Matthew: I will check for any missing VBE references.

Capricorn1: I will make the change to my "set rst" statement.

Will be back shortly...

Thanks for your fast responses.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Destiny947Author Commented:

No missing references, and even with the corrected syntax, I still get the same error message.

Rey Obrero (Capricorn1)Commented:
try this, see if you still get the error

Set rst1 = db.OpenRecordset("tblPlan")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Destiny947Author Commented:
be right back...
Destiny947Author Commented:
Hi Cap,

The error did not occur with that change.

What does this suggest?
Destiny947Author Commented:
This event requires that only one person is accessing the table at a time to  find the max number and then assign the next sequence.
Destiny947Author Commented:
I'll ask another question to address how the code should be written so that this table is locked.

This 1 step forward, 2 steps back is so frustrating...

Thank you...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.