Link to home
Start Free TrialLog in
Avatar of mickeyshelley1
mickeyshelley1Flag for United States of America

asked on

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
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

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...
JimD.
Avatar of mickeyshelley1

ASKER

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..
Image1.jpg
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?

JimD.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I moved everything into a new blank database which corrected the issue.