Problem Running VBA Code after Reloading Operating System.

Windows 7 Home Premium
Access 2003

I have recently re formatted and reinstalled office 2003 and since then I get the following error when ever i attempt to run any vba code i.e. to close a form, to open another form, to save a record, or simply go to a new record.

The expression On Click you entered as the event property setting produced the following error: A problem occured while Microsoft Office Access was communicating with the OLE server or ActiveX Control.

this is an example of vba code i have on a button to save current record and go to a new record.

Private Sub Command12_Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.GoToRecord , , acNewRec

End Sub
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
If that doesn't work, you might try a repair or reinstall of Access/Office.

Also - does this occur on other databases, or just this one? If it's ONLY this one, you might need to perform maintenance on the database (i.e. compact, or move everything to a new, blank database).
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You have a broken VBA reference.  Open a module, click tools/references and then check any un-checked reference.  Close the DB and Access, re-open and uncheck the reference you just checked.

Then do a compile.  If no errors, you should be set.  If not, you either:

a. need to add a reference that the app needs
b. Need to re-register DAO if your using it.
c.  Need to either decompile or create a fresh DB as you might have some VBA project corruption.

Bounce back and let me know...
mickeyshelley1Author Commented:
The database in question works fine on others computers, it worked fine on this computer until it crashed and I had to do a reinstall. I checked the references and didn’t find any “missing” so I am at a loss..
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Well your using DAO, so go ahead and re-register that (won't hurt):

1. Drop to a command prompt.
2. CD to Windows\system32
3. Type

  Regsvr32 "<path to the DAO DLL>"

usually it's

regsvr32 "c:\program files\common files\microsoft shared\dao\dao360.dll"

  But check the path in the reference dialog.

 Also, did you follow the reference refresh procedure I gave in my first comment?

mickeyshelley1Author Commented:
I moved everything into a new blank database which corrected the issue.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.