Invalid database object reference.

I have a function that executes three queries. When I try to execute the queries I receive:

"Run-time error '3276': Invalid database object reference."

Below is my code. I have checked my tables, they are all fine. I haven't run into this error before and don't really know where to start. Thanks in advance.

Code: Dim vQueryName As String DoCmd.SetWarnings False vQueryName = "qryAppend_HIST" DoCmd.OpenQuery vQueryName, acViewNormal


Post your answer or comment

comments powered by Disqus
Access 2010 running on Windows Server 2008 (both 32 bit)
Stdole2 - Why is it in MS Access 2010?
All is running fine until the day before Thanksgiving.
Access 2010 Front End - and Back End are on a Windows 2008 server (for Citrix use). The image on the network can be run by any user with Windows 7 with no problem.

When running the same application (or a release two weeks previous) the "invalid Database object reference." error pops up as the Home (startup) form attempts to load.

Created a module to list references:
Note: the Stdole2 does not show up on the Tools - Reference! 'ListReferences
'VBA: C:PROGRA~1COMMON~1MICROS~1VBAVBA7VBE7.DLL
'Access: C:Program FilesMicrosoft OfficeOffice14MSACC.OLB
'stdole: C:Windowssystem32stdole2.tlb
'DAO: C:Program FilesCommon FilesMicrosoft SharedOFFICE14ACEDAO.DLL
'ADODB: C:Program FilesCommon FilesSystemadomsado15.dll
'Excel: C:Program FilesMicrosoft OfficeOffice14EXCEL.EXE
'Office: C:Program FilesCommon FilesMicrosoft SharedOFFICE14MSO.DLL
'VBIDE: C:Program FilesCommon FilesMicrosoft SharedVBAVBA6VBE6EXT.OLB

Running the same function on Win 7 or Server 2008 - validated the name and path are exactly the same except:
All of the references check out on Server 2008 except that stdole2 is in a system 64 folder. The sys admin shows that it has not changed.
Yet stdole does not show up in the VBA Tools-reference

My guess is that something changed on the Server 2008. I am looking for clues to hand to the sys admin. All previous version releases for Access 2010 have this exact problem now. Yes, I did compact and repair both FE and BE. All files are in the same directory.

I have spit database
Copys of FE on two computers
BE on shared file
Either computer can make changes, however if we try to open front end at same time on both computers the last one to open FE will get message invalid database object reference

I do not have the slightest idea what to do.
Windows XP patch 3
using ACCESS 2010 with file databse in 2007 format

I am attempting to run the below append query. When I run it in Datasheet view it runs just fine. However, when I try to append it throws the error "Invalid Database Object Reference". Can anyone help out or point me in the right direction? I'm at a loss as to where to start. I have ran compact and repair on back-end DB...All is well...

Code: INSERT INTO tblSLAudit_Exceptions ( EXCEPTION_ID, DIVISION, REGION, DISTRICT, STORE, TRANS_DATE, CASHIER, TOTAL_AMOUNT, TOTAL_COUNT, EXCEPTION_TYPE, RESPONSE_TYPE_ID, NO_OF_ASSOC_AFFECTED, COMMENTS, MODIFIED_DATE, CLOSED_DATE, STATUS, DUE_DATE, INSERT_DATE, EMPLOYEE_NUMBER, BASE_STORE, NO_OF_HOURS_IMPACTED, BEGIN_DATE, BEGIN_TIME, REOPEN_DATE, REOPEN_TIME, IS_EDUCATED_ON_REGULATIONS, END_DATE, CASE_VALUE, NUMBER_OF_AFFEC_STORE_MANG, NUMBER_OF_AFFEC_AST_STORE_MANG, NUMBER_OF_AFFEC_CASHIERS, NUMBER_OF_AFFEC_OTHER, IS_STORE_HR_CHANGE_REQUEST_COM, HIST_CURR ) SELECT SLAUDIT_FDT_SA_EXCP_SUMM_HIST.EXCEPTION_ID, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.DIVISION, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.REGION, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.DISTRICT, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.STORE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.TRANS_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.CASHIER, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.TOTAL_AMOUNT, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.TOTAL_COUNT, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.EXCEPTION_TYPE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.RESPONSE_TYPE_ID, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NO_OF_ASSOC_AFFECTED, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.COMMENTS, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.MODIFIED_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.CLOSED_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.STATUS, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.DUE_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.INSERT_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.EMPLOYEE_NUMBER, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.BASE_STORE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NO_OF_HOURS_IMPACTED, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.BEGIN_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.BEGIN_TIME, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.REOPEN_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.REOPEN_TIME, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.IS_EDUCATED_ON_REGULATIONS, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.END_DATE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.CASE_VALUE, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NUMBER_OF_AFFEC_STORE_MANG, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NUMBER_OF_AFFEC_AST_STORE_MANG, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NUMBER_OF_AFFEC_CASHIERS, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.NUMBER_OF_AFFEC_OTHER, SLAUDIT_FDT_SA_EXCP_SUMM_HIST.IS_STORE_HR_CHANGE_REQUEST_COM, "HIST" AS HIST_CURR FROM SLAUDIT_FDT_SA_EXCP_SUMM_HIST LEFT JOIN tblSLAudit_Exceptions ON SLAUDIT_FDT_SA_EXCP_SUMM_HIST.EXCEPTION_ID = tblSLAudit_Exceptions.EXCEPTION_ID WHERE (((SLAUDIT_FDT_SA_EXCP_SUMM_HIST.EXCEPTION_TYPE)="HSLC") AND ((tblSLAudit_Exceptions.EXCEPTION_ID) Is Null));

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

Hello,

I have a problem and I hope you will agree to help me.

After modifying database links (front end to new backend),
one form does not open and generated reference error 3276.

I open the form by clicking on tree control node.
but It does not open directly from DB window.

but, If I compact & Repair the file it opens correctly.

What should I do in order to ovoid this error ?

Thank you for your help

Code: Private Sub menuTree_Click() Dim strcrit As String stricrit = menuTree.SelectedItem.Key DoCmd.Close DoCmd.OpenForm stricrit End Sub

I have a front end where the path to the backend has changed. Should be easy to fix.

Except that now when I open the database it crashes out of Access. I get a series of "Object not found" or "Invalid Database Object Reference" errors in a row and then I get to a crashed macro from the Switchboard saying:

SwitchboardID, DLookUp("SwitchboardID","Switchboard Items","[ItemNumber] = 0 AND [Argument] = 'Default'")

Error 53

When I hit "Stop all macros" (my only option) I end up getting booted out of the database to the Access loading screen (for creating a new database.)

I think the mistake I made is that the switchboard has some extra listboxes on it that look into the linked tables. Or maybe there's something that closes Access when you exit the switchboard (although I don't think I put this in).

The problem is that I can't even look at the forms now. I can't look at the code. I can't change the path for the linked tables. I just go through this series of errors and then get booted out. If I "ctrl + break" my way through it I get an extra error from the switchboard (error 0) and then still get pushed through to this next error and get booted out.

Is there a way to open the database in a "safe mode" or a dead mode where the links are ignored or something? I can't even repair it in it's current state.

I have a DB that was in use on one computer. Now, I need to set it to work simultaneously on two computers.

DB is split to one Access file that contains only tables and to another that has forms, reports, queries, macros and modules. One copy of Access file containing forms, reports... is copied on the computer nr. 2 while computer nr. 1 contains one copy of file with tables and one copy of file with form, reports... Both Access files with Forms, Reports... are accessing the same one file containing tables.

It all works fine in case program is active only on one computer, or if it is initiated first on computer nr. 2 and then on computer nr. 1. In case the program has been initiated on computer nr. 1 first, it does not work on computer nr. 2. Messages "Invalid database object reference." followed by "Object invalid or no longer set." then followed by "The visual basic for Applications project in the database is corrupt." then again for 4 times "Object invalid or no longer set." then again "Invalid database object reference." for 3 times and after that Access allows only blank database to be opened.

What should I do to make computer nr. 2 work unrelated to which machine triggered it first?

Hi friendly people

I am running Access 2003 and office 2000 on an XP install and am encountering the following errors..

"Security warning: Unsafe expressions are not blocked" which prompted me to install new MS updates - which I did. NO use. I still get the error when I open any Access DB

If I bypass that error I get another error "The file may not be safe if it contains code that was intended to harm your computer..."

In vain I tried to isolate the problem and import the tables and queries I desperately need into a new blank Access DB ...

In doing this I got two errors - 1 - Disk or network error and 2 - Invalid database object reference -- in that order.

This whole problem began when I was unable to run any typw of date parameter other than a [pBegindate] to [penddate] function.

At that point my IT people took over and reinstalled Access and office upgrading it to its current non-functional configuration.

I have a feeling this is a missing reference but have no code in any front end DB to test that theory on...any ideas..

BTW - if I cannot fix this I cannot work which means I cannot make any money today --I will make a donation to the Access gods in the honor of the person who helps me resolve this!

Thanks much!

K

I had an access 2007 database splitted into a front and a back ends. the frontend was moved to other computers on the network so that they all will link to the one backend on the origional computer.

what i did on the frontend computer is:

1- omitted the tables.
2- external data >> import >> access >> browse (and chosed location of the backend from the network) >> "link to the data source by creating a linked table". >> ok ( and selected all tables from backend).

The problem is that when i press the button that leads to the first form which is bound to the first table i get this error:

run-time error '3276':
invalid database object reference.

if i pressed debug, the following line gets highlighted:

DoCmd.OpenForm "family", acNormal

what am i doing wrong?

Here's the code for the button that opens another form. It has been working fine in 2007, but since installing 2010, it gives me an error stating "Invalid Database Object Reference". Any advice/tips on this would be greatly appreciated. Thanks in advance.

Private Sub btn_Locations_Click()
On Error GoTo Err_btn_Locations_Click
Forms!job.GoToPage 1
UpdateJobNow
DoCmd.OpenForm "Location"
Me.Visible = False

Exit_btn_Locations_Click:
Exit Sub

Err_btn_Locations_Click:
MsgBox Error$
Resume Exit_btn_Locations_Click

End Sub

Hi,

I desperately need some help as I am tearing my hair out!

I have a split and shared database for my company, but not all users can use the system. Why?

Access 2010
Split database
Front & back ends saved on shared drive
Shortcut on terminal server - Maybe shortcut is wrong?
Shared database, not exclusive

I have read somewhere that each user should have the front end saved to their computer, but I'm not sure this applies as the front end is currently on a shared drive. Also, surely space and memory wise, this isn't helpful? What happens when you want to update the front end - does everyone have to resave the new copy?

Some users can use the system no problem, but other get an error code of: "Invalid database object reference".

Please help me as I'm really not sure what to do for the best.

Thanks.

I have a newly created ms2007 access database.
contains only data.

i clear data from an external database.
I open the backend data database, and close it to repair and compact
to remove deleted data

I add data from front end calculations,

I open the backend database to review the data,

and then close it to repair and compact, and randomly an error message comes up

Invalid database reference. . .

Is my 1T esata drive which is about 3 years old getting worn out?
or is this another type of error?

thanks

sportsguy

I am currently havinbg a problem with a function within an Access 95 module.

The problem code looks like this:

1> Function AddNewResponse()
2>
3>
4> On Error GoTo AddError
5>
6> Dim db As DATABASE
7> Dim rs As Recordset
8>
9> Set db = CurrentDb()
10> Set rs = db.OpenRecordset("Response", DB_OPEN_TABLE)
11>
12> rs.AddNew ' Add the new record
13>
14> rs!Name = Forms![update incident]!RName
15> rs!Date = Forms![update incident]!RDate
16> rs!Time = Forms![update incident]!RTime
17> rs!Response = Forms![update incident]!RDesc
18> rs![Incident Number] = Forms![update incident]![Incident Number]
19> rs![Series Identity] = Forms![update incident]![Series Identity]
20>
21> rs.UPDATE
22> rs.Close
23>
24> Exit Function
25>AddError:

The problem is that line 6 is not working as it should be creating db as a DAO database object, instead it appears to be creating a VBA DATABASE statement.

This line is in one version of the database which works fine (this database is a standalone database), however, in the current multi-user database the function does not work. I have checked that the references are pointing to the same things and they are, but the problem still occurs in the newer db.

If there is anyone who is able to help please email me

Hi people,

I'm using the following code to generate a list of the reports I want for a combo box:


	Code:
	For Each accObjectQry In CurrentData.AllQueries

   Me.cboSelectReport.AddItem accObjectQry.name 

Next

This grabs the queries for the reports I want to generate on my form through the combo box.

However, the name of the report, is taken from the name of the query I use to generate the report, e.g.

Report: rptSale has query name = qryRptSales.

I want to keep the names as they are for consistency in my naming conventions for the database and to avoid programming problems with spaces in db object names.

I thought I could use the Description field of the query. So I right mouse clicked on my query, then went to Properties, and under Description, wrote a nicely formatted name for the query ("My Sales Report").

I was hoping to call that Description field through VBA. But it doesn't seem to be an option when I try to reference the


	Code:
	Dim accObjectQry As Access.AccessObject

variable I setup.

Is it possible to call the Description of a Database Object (in this case a query) through VBA?

Thanks in advance.

Recently upgrated to 2000 and started a new project. When trying to dimension a variable as a database object, the message, "User-defined type not defined", appeared. It occurred on this simple code:

Dim dbs As Database

It is referring to the word "Database". As I typed the Dim statement, I noticed the drop-down did not list "database" as a possible object type. Strange. I have used this code before. A previous application done in Access 97 lists "Database" as an object and runs with no problem.

What causes this and how do I get "database" as an object back?

StephenS

String Search Through Access Database Objects

How can one search through database objects for a string; for example, say i renamed an object; how can i search the DB for all references of this object in the forms, modules, etc, with VB code? I know there are database products that do this (manually), but i want to learn how to do this myself.


Thank you!

Llyal

Hi!

I'm working on a project where users are interacting with an access database through a collection of userforms in Excel.

I've got an issue with a query that I try to run from a sub routine in excel. The query works fine when i runnit i access but when i try to execute it through a database object in excel(through vba) i receive a runtime error. The error states that there is an undefined function in the expression.
The aim of this query is to append all customers along with a datevalue (selected from a userform) to a table (provided that the record doesn't exist already). The table receiving the records holds customer, date and price.

i've encountered this issue or similar issues several times and would like to find a better solution to it. I feel all my ideas are a bit retarded and imagine that someone here has a way more elegant solution.

The ideas that i have thought of this far is
1) Create a temp table, delete old values, load new values.
Then the date values are available to use in a table and i have no trouble to create the append query
2) Create a VBA procedure where i iterate through the records valid for the date and compare with all customers and then append the ones thar are missing.
3) Create a macro which runs the SQL expression and then create an access application object and run the macro (using DoCmd.RunMacro) through excel (however this would require that all the users has a license for ms access)

Btw i also feel my SQL expression is a bit retarded. First of i tried setting using only a string in the second join criteria but that didn't work. However I did manage to get to it work by concatenate the field with a string and erase the field value.

	Code:
	INSERT INTO MontlyResultValues ( CustomerName, ValidForMonth ) 

SELECT CustomerToSAPID.CustumerName, #9/1/2010# AS DateForInput 

FROM CustomerToSAPID LEFT JOIN MontlyResultValues ON
CustomerToSAPID.CustumerName 
= MontlyResultValues.CustomerName 
And
 Cstr(Replace(CustomerToSAPID.CustumerName,CustomerToSAPID.CustumerName, '') & '2010-09-01')  
= Cstr(format(MontlyResultValues.ValidForMonth,'YYYY-MM-DD')) 

WHERE (((MontlyResultValues.CustomerName) Is Null))


the vb code where i receive the runtime error

	Code:
	Private Sub ExampleSub()

Dim strSqlCommandText As String
Dim pubDatabaseForPfMng As Database
Set pubDatabaseForPfMng = OpenDatabase("C:Documents and Settings" & Get_User_Name & "DesktopExample.mdb", False, False, "MS
Access;PWD=" & strAccDbPassW & "")

strSqlCommandText = "INSERT INTO MontlyResultValues ( CustomerName, ValidForMonth ) SELECT CustomerToSAPID.CustumerName,
#9/1/2010# AS DateForInput FROM CustomerToSAPID LEFT JOIN MontlyResultValues ON CustomerToSAPID.CustumerName =
MontlyResultValues.CustomerName And Cstr(Replace(CustomerToSAPID.CustumerName,CustomerToSAPID.CustumerName, '') &
'2010-09-01')  = Cstr(format(MontlyResultValues.ValidForMonth,'YYYY-MM-DD')) WHERE (((MontlyResultValues.CustomerName) Is
Null))"
pubDatabaseForPfMng.Execute strSqlCommandText, dbFailOnError

end sub



I have 2 newer installed PC's that cannot access existing databases out on server. When click on Access '95, machine says invalid database object, I click OK. Machine says Access couldn't create storage space for a visual basic module. Solution..if database is on a network drive, check your network connection and try again. Everything is connected and I click OK. Machine then says Microsoft Access Device I/O error, and when click OK kicks me back to desktop. Can anybody shed any light on this as I do not know how to fix.

Help Please,

I have an access database that is housed on a novel network. There are multiple users that have used this database for more then a year with no problems. But starting Thursday an error started occuring when this code was used:


Me.TimeIs = Time()


They would recieve this error.


Compile Error:
Database or Reference can not be found.


It would then highlight the Time function and stop the code.

The problem is that, it is not everyone. It started with one person, now 8 people have a problem. But more then half still have complete usablilty.

We have re-imaged the machine, but the problem still occurs.

Any ideas?
Thanks
BDS

Hi all

I am getting a "Invalid or unqualified reference error" each time I run this code in a new record button (In access). when there is a number in the quantity other then one, it is supposed to add or delete records that have the same ISBN Number (Same book)


Public Same_Book As String

Private Sub New_record_Click()

If (.Quantity.Value > 1 and .Quantity.Value > .Number_Of_records_with_Same_ISBN.Value) Then
' if the user entered a Quantity value greater then what is currently enteredDoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
Do While (.Quantity.Value > 1) And (.Quantity.Value > .Number_Of_records_with_Same_ISBN.Value)DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdPasteDo Until (.Quantity.Value = .Number_Of_records_with_Same_ISBN.Value)

Else
If (.Quantity.Value < .Number_Of_records_with_Same_ISBN.Value) Then
'if the user entered a quantity lower then the previous quantity value
Same_Book.Value = [ISBN_Number].Value
Do While (.Quantity.Value < .Number_Of_records_with_Same_ISBN.Value)DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.FindRecord "[ISBN_Number] = Same_Book", acEntire, False, , False, acCurrent, TrueDo Until (.Quantity.Value = .Number_Of_records_with_Same_ISBN.Value)

Else
If (Quantity.Value = 1) Or (Quantity.Value = Number_Of_records_with_Same_ISBN.Value) Then
'This is for a new record
DoCmd.Save
DoCmd.GoToRecord , , acNewRec
End If
End IfEnd If
End Sub


Thanks to all in advance

Scott

Hi,

Is there any method to check if a DAO-databaseobject/connection is still valid?
I've an Database-object that stays open for a long time, and it's possible that the pc goes to standby-mode or that a network-connection is lost for a short time. Now i'm interested in a way to restore the connection when it's necessary.
So i'd like to know a method to check if the connection is 'alive'. Requesting properties (names of tabledefs/querydefs e.g.) from the object is not succesful.

thx,
Bert

I am trying to figure out how to write code to transfer all of a database's objects (tbl,qry,frm,rep,mcr,mod) to another database.

I have been able to do this with tables and queries by looping through each object definition(tabledef, querydef) in the respective class for each objecttype(tables & queries).

I haven't figured out a way to accomplish this with the other database objects. Any Ideas?

I'm doing some stuff in excel and some of it is going to be easier to get results of calculations by using sql rather than coding excel functions.

For some of these calculations I am wanting to use the following sort of sql.


	Code:
	select stuff from table
where stuff not in (select things from otherTable)

Now the tables in both these instances are excel named ranges which are in two different workbooks. As I can't add multiple workbooks to a single dao database object I am trying to add a link to the second table in the database object. I've got the following code:


	Code:
	Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim tdf As DAO.TableDef

Dim linkpath As String
Dim path As String

path = Workbooks("otd3.xls").path & "otd3.xls"
linkpath = Workbooks("lead times.xls").path & "lead times.xls"

Set db = DAO.OpenDatabase(path, False, False, "Excel 8.0")

Set tdf = db.CreateTableDef("LeadList")
tdf.Connect = "Excel 8.0;DATABASE=" & linkpath
tdf.SourceTableName = "Blah"

db.TableDefs.Append tdf

The code however fails on the last line giving me a run time error 3251 "Operation is not supported for thistype of object". anyone know if this is possible and if not got any suggestions on how I can acheive this.

I know could just just create a second database object and then copy the data into the same workbook and then create a named range and then use that in my SQL statement would rather use an alternative if I can.

Hi -

Is there an object reference delineating whether an 'object' (and I may be using the term incorrectly) is a table, query, form, report?

I'm attempting to develop a command button that when clicked, would open an object (table, query, form, report) specified in a table (probably an [ObjectName], [ObjectType]) in somewhat the same way that you can have a hyperlink field that, when clicked, opens that particular hyperlink.

Your help appreciated. -- Bob


Not finding an answer? Try a Google search.