Invalid Reference when starting database

mafhobb

Registered User.
Local time
Today, 00:37
Joined
Feb 28, 2006
Messages
1,249
Hello.

I've been working on a database that is to be installed on a network. The database has been created using Access 2010 but I am the only one with a full version as everyone else is using Access 2010 Runtime. The current/final version of this database is split and the BE is located on a network drive and I am now trying to get it distributed.

This database has been tested in this final configuration and troubleshooted extensively on my computer (which has the same domain and active directories as everyone else) and it works really well, but when attempting to install it on another computer I run into a problem.

"Invalid Database Object Reference" comes up as the login screen opens up.

If one clicks "OK" this error disappears and the login screen becomes accessible, however, the username combo box that is supposed to list the username only brings up an empty list and even when entering a valid username it does not recognize it.

Any ideas on what is happening?

Thanks!

mafhobb
 
You have a VBA reference, or control, which is installed on your computer but isn't on theirs. What references are checked in the references dialog if you open the database and go to the VBA Window and then TOOLS > REFERENCES?
 
Hi BobLarson

The references installed on my computer (on which the db works) are:

Visual Basic for Applications
Microsoft Access 14.0 Object Library
OLE Automation
Microsoft Office 14.0 Access database engine Object Library
Active DS Type Library

How can I check what references are on the other users' computers if they only use Runtime 2010?

Then, when I find out...How do I install those references?

Thanks

mafhobb
 
I know this error very well.
It is a bug in A2010.
This error happens when the frontend and the backend are in different folders and you are using A2010. We are waiting for SP1.
I believe that you can get around the error by doing a compact and repair.
I haven't needed to try the compact and repair as I was able to put both be and fe in the same folder for my client.

It is listed as an A2010 bug on Utter Access - where there is the tip about doing a compact and repair.

I ended up making the accde on my client's computer instead of just copying the accde from my computer - I can't quite remember if that was the only way I could get it to work.
 
Thanks Spikepl. I had not seen this link and I read it with great interest. I hope that the solution they propose helps. I have actually asked a question on that forum also regarding how to apply their solution to my case as my users have Runtime (which I think should not matter but I am not sure) as well as what the final code is and where it goes.

I will definitively try it but I still wonder if in my case this is not a bug problem but an actual reference problem. Just so I do not run into this problem in the future I really would like to learn where to find the references (libraries and files, I guess) and how to install references on a machine running Runtime.

Thanks

mafhobb
 
Hello Jeanette

Thanks for your input. I was replying to spikepl as you were adding your comments to the post.

I am happy that you found another solution to this problem. Because my database is to be used by several different people I was planning to have several different FE installed (one on each user's machine) and just one BE (on the network). Your solution seems to involve one single FE, which I am not sure it will work if different people will use the database at the same time....will it?

Also, if I logged in the network as one of the users and created the accde, then what would happen when the other users tried to open it? would they get the error?

thanks

mafhobb
 
Try the suggestion in the utter access post of resetting the querydefs after relinking. If that works, that is the one for you.
Don't even think that you have done something wrong with references - this is definitely a bug in A2010. I know how much time I spent confirming that it is a bug - I never want to waste time like that again.
 
Thanks Jeanette!

I know this is asking a lot, but is there a chance you might look at the code below (got it for the link) and tell me if you think it is correct and where to put it?

Code:
'------------------------------------------------------------
' AutoLinker
'
'------------------------------------------------------------
Public Function AutoLinker()
On Error GoTo AutoLinker_Err

If (CheckLinks() = False) Then
fRefreshLinks

Dim QD As QueryDef
For Each QD In CurrentDb.QueryDefs:  QD.SQL = QD.SQL: Next

' From Code Courtesy of Dev Ashish
DoCmd.RunCommand acCmdCloseDatabase
End If
DoCmd.OpenForm "Name of main form to Open", acNormal, "", "", , acNormal


AutoLinker_Exit:
Exit Function

AutoLinker_Err:
MsgBox Error$
Resume AutoLinker_Exit

End Function
'********************************************************
Public Function CheckLinks() As Boolean
' Check links to the database; returns True if links are OK.

Dim DBS As DAO.Database, rst As DAO.Recordset

Set DBS = CurrentDb
' Open linked table to see if connection information is correct.
On Error Resume Next
Set rst = DBS.OpenRecordset("One of the tables that contains a record")
' If there's no error, return True.
If err = 0 Then
CheckLinks = True
Else
CheckLinks = False
End If

End Function

I think part of it goes in the starter form but the "public function" code also makes me think that it should go on a module and that it should be called from the starter form right away.

mafhobb
 
OK, so the first function would be in a module (class module?)
Code:
Option Compare Database
Option Explicit
'------------------------------------------------------------
' AutoLinker
'
'------------------------------------------------------------
Public Function AutoLinker()
On Error GoTo AutoLinker_Err

If (CheckLinks() = False) Then
fRefreshLinks

' From Code Courtesy of Dev Ashish
DoCmd.RunCommand acCmdCloseDatabase
End If
DoCmd.OpenForm "Name of main form to Open", acNormal, "", "", , acNormal


AutoLinker_Exit:
Exit Function

AutoLinker_Err:
MsgBox Error$
Resume AutoLinker_Exit

End Function

The second one again in a module (class module?)
Code:
Option Compare Database
Option Explicit
End Function
'********************************************************
Public Function CheckLinks() As Boolean
' Check links to the database; returns True if links are OK.

Dim DBS As DAO.Database, rst As DAO.Recordset

Set DBS = CurrentDb
' Open linked table to see if connection information is correct.
On Error Resume Next
Set rst = DBS.OpenRecordset("One of the tables that contains a record")
' If there's no error, return True.
If err = 0 Then
CheckLinks = True
Else
CheckLinks = False
End If

End Function

Then the first function would be called from the first form that opens up in the database, preferably an invisible, empty form.

This third function could be called after linking the tables to redefine the queries
Code:
Public Function Fix2010()
Dim QD As QueryDef
For Each QD In CurrentDb.QueryDefs: QD.sql = QD.sql: Next
Set QD = Nothing
End Function

Does this sound about right?

Mafhobb
 
With the bug, the relinking to tables in the backend does its stuff without any problems.
Straight after correctly relinking, the bug appears.
So I suggest
On your startup form call the code that does the relinking.
The very next thing needed is to call the code to reset the query defs.

Now I haven't tested the above, but that would be the way I would do it.

I always put my relinking code in a standard module and call it from the startup form.
 
Hello.

Well, I am trying this and I am running into an error.

"sub or function not defined" at fRefreshLinks

Also, does "option Explicit need to be in the code for each module?

Thanks

mafhobb
 
I don't see the code for the function called fRefreshLinks in the code you posted above.
You should be able to find that function on the same website where you got the code that calls fRefreshLinks.
I don't use that code. I use the JStreetRelinker.
You can get it here if you want (http://www.jstreettech.com/cartgenie/pg_developerDownloads.asp, scroll down to the JStreetRelinker)
Yes, you do need to put Option Explicit in each module.
 
Reviewing the readme table...
 
Last edited:
OK, I've implemented this method to the database and I have tested it successfully in my computer.

Next, I'll test in in the computer that was giving me trouble.

Mafhobb
 
By the Way...

Since I do not want any of the forms in the db to load until this check is done, How do I make sure that this happens?

Is the Autoexec macro enough to make that happen?

If not, what is the way to do it?

mafhobb
 

Users who are viewing this thread

Back
Top Bottom