[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem Running VBA Code after Reloading Operating System.

Posted on 2011-05-09
5
Medium Priority
?
256 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:mickeyshelley1
  • 2
  • 2
5 Comments
 
LVL 58
ID: 35723179
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.
0
 

Author Comment

by:mickeyshelley1
ID: 35723388
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
0
 
LVL 58
ID: 35723492
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.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 35724773
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).
0
 

Author Closing Comment

by:mickeyshelley1
ID: 35764772
I moved everything into a new blank database which corrected the issue.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question