Solved

Expression error while trying to open an Access Database

Posted on 2006-06-30
11
1,968 Views
Last Modified: 2012-05-05
I am receiving the following error when trying to open a specific access file:

The expression On Open you entered as the event property setting produced the following error: There was a problem referencing a property or method of the object.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

However, when I try to open this file from another computer on the network, it opens with no problem.  Both machines are running XP Operating System and Office XP.
0
Comment
Question by:Siarra
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 17020104
Sounds like on that specific pc there is a reference missing.

Go to that pc, open the app with Shift button held down.
Then in the Databases window ({f11} if it doesn't show automatically) go to Modules tab and double-click on any code module.
Then go to Tools menu, References..., and in the References dialog see if there is any reference checked that has a prefix of 'MISSING: '
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17020123
Apart from what Jim said
can u go into VBA and do a debug/compile
does it fall over anywhere
if no errors then nothing will happen
0
 

Author Comment

by:Siarra
ID: 17020133
It is an *.mde file.  When I go to the modules tab and try to open any code module I get the error:

"you can't import, export, create, modify, or rename any forms, reports, pages or modules in an mde database."
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17020146
The only thing you can really do here is to put the .mdb file (that created the .mde) on that machine, and repeat the steps I listed above.
0
 

Author Comment

by:Siarra
ID: 17020204
Same thing.  I am opening the .MDB file rather than the .MDE, and I still get the same error mentioned in my previous comment.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 65

Expert Comment

by:Jim Horn
ID: 17020241
Just to clarify...

I am opening the .MDB file rather than the .MDE, and I still get the "you can't import, export, create, modify, or rename any forms, reports, pages or modules in an mde database." error message?
0
 

Author Comment

by:Siarra
ID: 17020288
Yes.
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 17020582
Sounds like someone renamed his mde extension to mdb.
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 17020594
The expression On Open you entered as the event property setting produced the following error: There was a problem referencing a property or method of the object.

I have gotten this from time to time if a linked table has dropped out of my programs database. My on open macro tries to execute a module that involves a linked table and it fails. Since it's run-time, the error messages aren't all that specific. Just a thought.
J
0
 

Author Comment

by:Siarra
ID: 17020726
When I opened the database as Jim requested earlier (holding the shift key), I tried to open one of the table just for general purpose, and it gave me an error that it could not open because 'X' path could not be found.
I guess the person who created the DB had it linked to another file on a network drive.  We were experiencing network problems earlier and although my network drive showed that it was mapped, it did not have a connection with the file server.  Once I remapped the drive, I was able to open the file with no problem.  Thank you all for your help.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17020782
In that case, it sounds like a table refresh issue, which you manually resolved.

If you want your app to programatically relink tables, here's a code function that would allow your app to do it automatically (uses DAO):

Function fncRelink()
'
Dim td As DAO.TableDef

For Each td In CurrentDb.TableDefs
  If Len(td.Connect) > 0 Then
     td.Connect = ";DATABASE=" & Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\")) & Mid(td.Connect, InStrRev(td.Connect, "\") + 1)
     td.RefreshLink
  End If
Next

MsgBox "Ready, tables relinked"

End Function

(Source: http://www.experts-exchange.com/Databases/MS_Access/Q_21260038.html#12945142 )

Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

911 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now