Error 2766

RoomTariffs.zipHello everybody,

I am developing a Hotel Room Booking Database. I created a function to pull the Room Tariff applicable on the booking date. However, when the query is run it shows error # 2766. I have attached the file for analysis. Please tell what I have done wrong.


Post your answer or comment

comments powered by Disqus
I'm a beginner so go easy on me.

Ok, what I would like to do is simple. I have a combo box in a subform with a number of product related fields. I would like the form to automaticall display the unit price upon selecting the product from the combo box. So, what am I overlooking here....

The error I'm getting is

ERROR 2766 "The object doesn't cotain the automation object 'XXXX'

Where XXXX is the Product ID selected by the combo box. The product ID's follow the format P100, P101, P102, etc... Maybe I should also include my sql statemet for the combo box.

SELECT qryInventaire.[ProduitID], qryInventaire.[CatégorieID], qryInventaire.[Produit], qryInventaire.[QtyDisponible] FROM qryInventaire WHERE qryInventaire.[CatégorieID]="Marchandise" ORDER BY qryInventaire.[Produit];

So, I assume the problem is coming from my tblListeProduit table, but it does contain the ProduitID as a Primary Key.

My Code

Module Code:
__________________________________________________ _________________________

Public Enum StatutVenteEnum
Nouveau_StatutVente = 0
Facturé_StatutVente = 1
Fermé_StatutVente = 2
End Enum

__________________________________________________ ____________________________

Public Function DLookupNumber(Expr As String, Domain As String, Optional Criteria As String, Optional ValueIfNull = 0) As Variant
DLookupNumber = Nz(DLookup(Expr, Domain, Criteria), ValueIfNull)
End Function

__________________________________________________ ____________________________

Function GetPrixUnitaireProduit(lProduitID) As Currency
GetPrixUnitaire = DLookupNumber("[PrixUnitaire]", "tblListeProduit", "[ProduitID] = " & lProduitID)
End Function

__________________________________________________ _____________________________

Form Code:

__________________________________________________ _____________________________

Private Sub ProduitIDBox_AfterUpdate()
If Not IsNull(Me![ProduitID]) Then
Me![Quantité] = 1
Me![PrixUnitaire] = GetPrixUnitaireProduit(Me![ProduitID])
Me![Remise] = 0
Me![StatutID] = Nouveau_StatutVente
End If
End Sub
__________________________________________________ ___________________________

Hi members

I have a front end .mde created in Access.03 and placed in a PC with RunTime07- win7.32bit. In one of the multi-tab forms, i did a filtering by right Click, clicking eg "Filter By Selection" the following error appeared.

Error 2766 The object doesnt contain the Automation object. On closing this dialog the filtering happened without any problem ie continue to operate.

The same .mde never have this error in WinXp.sp3 and access03 but will occur in Winxp.sp3 with Access07 runTime.

Any experience on this??


I am totally new to Access 2010 and inexperienced.
I am trying to write code for an After Update event on a combo box (called Combo21 in my application) that will automatically supply a parameter to a parameter query based on the selection that the user makes in the combo box. The name of the query is qryUserPssPull and the parameter is enteruser.

I have written this for the After Update event:

Option Compare Database

Private Sub Combo21_AfterUpdate()
Dim userSelection As String
userSelection = Combo21.Text
DoCmd.SetParameter "enteruser", userSelection
DoCmd.OpenQuery "qryUserPssPull"
End Sub

But when I try to run it the error message I get is this:
Run-time Error '2766':
The Object doesn't contain the Automation Object, "Thomas."

(The combo box options are a list of employee names of which Thomas xxxxx is one. If I select a different employee name from the drop down list, I get the same message except with his/her name appearing in the error message.)

I apologize for the fact that this code probably demonstrates I am not too good at this...I am very much still learning.
I hugely appreciate any assistance offered. THANKS.

I am building my first web database (synced with sharepoint server) with limited experience of Access (have done some small non-web databases mainly for personal or self-teaching purposes).
I have found the answers or at least clues to help solve many of the problems I've come across so far, but this one has me stumped and I cannot find any problems which are quite the same, possibly because all the similar problems are not *web* databases and therefore tend to use VB rather than macros.

I have a form which allows quick changes to multiple records in a table, which only contains fields which may need to be changed en mass.
I have a (macro) button on each row of the multiple item (continuous) form, which opens another form with further details of the relevant record.
This works beautifully on the PC I am using to design and sync this database with the sharepoint server, however, when I click this button on the webform accessed through a browser (I have tried a couple of different browsers just in case lol) it does not open the detail form, but gives me the following errors.

"The object doesn't contain the object 'ID' "
(ID is the field I have used to specify the record to open in the detail form)

Followed by
Action Failed
Macro Name: View Modify New Products : editbutton : OnClick : Embedded Macro
Action Name: OpenForm
Arguments: Modify New Product Details, '=ID=' + Access.Actions.GetFormItemValue('Forms!View Modify New Products!ID',true) + '', Edit, Dialog
Error Number: 2766

This is the macro on the button:
Form name: Modify New Product Details
Where condition = [ID]=[Forms]![View Modify New Products]![ID]
Data mode: Edit
Window Mode: Dialog

Or if you're more comfortable viewing it as a line of code, it looks like this:
OpenForm (Modify New Product Details, [ID]=[Forms]![View Modify New Products]![ID], Edit, Dialog)

As previously mentioned, this works fine on my PC, which leads me to believe that I have the code correct, but after syncing with the server and accessing the webform on the network, it fails.

Any ideas?

Edit: Not sure if this is worth mentioning, but when i remove the [ID]=[Forms]![View Modify New Products]![ID] line from the "where" part of the macro, the form loads up fine, but of course goes to the first record instead of the specific record in line with the button- which is the desired result.
I would like to avoid the potential user errors and time wasting which is likely to ensue if I can't get this to work, so I appreciate any help anyone can offer!

Based on what lagbolt warned, a "string" doesn't work for the path name, so the blue text (mypath & objWkb) was replaced with the full path and file name (G:DataFolderDataFile1). Before doing this replacement, I confirmed that lagbolt was correct in predicting that the blue text would cause the next error.

Perhaps a string can't be used to describe a range, just as it didn't work in describing the path and filename . . .

Quote: Originally Posted by cyb3rwolf Hmm... I'm assuming the .Name property is the same as anything else i've worked with, should return the name of the worksheet. Let me try it and i'll get back to you shortly.

kathy - i put this thread in the general area, dealing with a backend corruption i had experienced and resolved. corruptions tend to manifest themselves with strange spurious errors, and standard routines start to fail

clearly you understand what you are doing, and yes there is almost bound to be some performance degradation using linked tables compared with non-linked.

one real additional issue with non split databases is that it becomes very hard to modify the functionality - whereas this is easier when the data is separate.

also, if the database itself uses local temporary tables, then you HAVE to have a split database, or ensure only one user can be in the dbs at a time, or one user may overwrite another users temporary table

in balance i would certainly side with bob and separate the data from the code, but its your system - as long as its backed up regularly, no doubt you can always recover to a safe point anyway.


JANR caught that one for me and I removed the tick mark. Back to getting the error.

I am now getting a new error & I know it's something simple I'm just not seeing & it's driving me crazy. The error is missing operator in query expression 'Vendor Hotline Log.Status = "Closed"'. I think it might be in my query in the Status field I have this in Criteria

	 In (([Vendor Hotline Log].[Status])='Open' Or ([Vendor Hotline Log].[Status])='Closed')

Hi all,

Hoping you can help. We have circa 12 users accessing SQL Server 2005 (SBS Server 2003) from Windows XP / Access 2007 front ends. The system has been live for 12 or 13 years with very little issue. 60 odd MsSQL tables and a good number of views.

Application will update one particular table using DoCmd.RunSQL. For the last couple of years, we would occasionally will receive a ODBC Timeout error when updating this one table.

All other table updates and views etc will be fine, just this one 'problem' table.

A SQL restart would normally fix this problem, but in the last couple of months, the frequency has increased and restarting the db would always fix the problem.

Updated access frontend and sql backend to use Stored Procedures and pass thru queries and we thought we had solved the problem, but alas the next day we began to receive ODBC FAILED errors. Restarting the db would not always solve the issue.

All users access MsSQL using the same SQL username. Have tried differing combinations of network group permissions and using direct SQL usernames.

All clients use SQL SERVER odbc connector. Have also downloaded SQL Native Client odbc to an XP machine, but this did not resolve the issue either.

Strange thing is - if someone else logs onto the same local machine, they can perform the update. This user also happens to be a server admin.

If I log into the (SBS) server remotely and run the application from the server desktop, the update also works fine also.

If I then make a 'problem' user a server admin, the update on the 'problem' table works fine.

What has come to light today is the server people did driver update on the server a few weeks ago - which apparently included a SQL driver update...Not 100% sure on this though...

Question is, could some memory allocation settings or similar have been changed as part of the update? It's all very odd

Did some quick research on Liability Insurance for Small Business or for Self-Employed Contractor. This poll / discussion is asking what do you pay? For 2013, my requirements changed.
There is
General Liability Insurance
Professional Liability Insurance (a.k.a. Errors and Omissions)
The Professional Liability Insurance can cover things such as Amendatory Endorsement - Claims Made By Any Regulatory Authority or Governmental Agency

Spent some time going over these. Found my general liability was cheap, but most things didn't cover real-world events. Not going to give any advice here except to shop around and ask hard questions.

For 2013 with $1,000,000.00 USD for each General and Professional:
General: Year: $276
Professional Year: $1,350
In general these were up about 45% from a poll with technology types back in 2003.

Please be incouraged to respond and discuss this.

If you are a consultant, self-employed, or independent, you have an increased chance of being required to get Professional Insurance.
Here is an intereting study / survey that includes Database Programmers:
Coverage for the liability arising out of the de-sign and manufacturing of technology-related products, the creation and implementation of soft-ware, and the provision of related services, is a growing business, with specialty coverages de-signed to cover the Errors and Omissions liability that may not be covered under traditional liability policies. Tech E&O coverages can be purchased for technology consultants, systems integrators, application service providers, Internet service pro-viders, Internet retailers, cloud services providers, network electronics manufacturers, medical tech-nology manufacturers, and telecom companies.

The following Code pops up when I run the "Web Compatible" check?

Error text A Table should have a Primary Key and it should be a number with field size 'long' to be compatible with the Web.
What it means The indicated table has one of the following problems:
· The table does not have a primary key.
· The data type of the primary key is not Number.
· The primary key Field Size is not Long.
What to do Change the existing primary key in Design view so that it has the correct data type and Field Size; or, create a new primary key for the table, using the AutoNumber data type. If Design view is not available, create a new table, and add to it the columns from the original table; then drop the original table.
My "EmpID" is the first four letters of the Last Name and the first 3 of First Name.

Is that NOT going to work? I know it says it won't, but I'm surprised that it doesn't.

(Previously posted to Reports section, incorrectly. Sorry.)

I'm using MS Access 2003.

I have a form that displays in datasheet view. When I select a record and hit my keyboard's Delete button, I see the following error:
Quote: The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time. This error *always* appears when deleting any record from this form. After clicking OK on this error, if I refresh the form, the record in question has indeed been deleted.

We use an Oracle back-end, and I have tried dropping the associated triggers and refreshing the table links, but the error message persists.

Some web pages suggest database corruption, but if I Compress and Repair, I still have the problem.

Any other ideas of where to look?

Any help you can give would be appreciated.



I'm using MS Access 2003.

I have a form that displays in datasheet view. When I select a record and hit my keyboard's Delete button, I see the following error:
Quote: The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time. This error *always* appears when deleting any record from this form. After clicking OK on this error, if I refresh the form, the record in question has indeed been deleted.

We use an Oracle back-end, and I have tried dropping the associated triggers, but the error message persists.

Any other ideas of where to look?

Any help you an give would be appreciated.



I know that this topic has been discussed, but I can not get my report to work. I have 2 text boxes that are giving me this message. I think that I should use the Nz function, but no matter what way I type it in, there is always an error message. I think it has to do with the fact that the calculated field is from a sub report. Could someone help me out. One of the fields as it stands is [Copy of Payments].[Report]![Text24]

I am trying to open my report to fit the window and have this code behind the on open event of the report:

Private Sub Report_Open(Cancel As Integer)
DoCmd.RunCommand acCmdFitToWindow
End Sub

But when I try to run my report it gives me this error message. What could be causing this?

Run-time error 2046
The command or action 'FitToWindow' isn't available now.


I have a invoice report made up of 2 sub-reports. 1 for finished goods and the other for stock items. Finished goods appear on almost all of the invoices but stock items rarely do. So when I have no entries in the queried stock items table, the report doesn't exist and so I get an error on the calculated total box which tots up the totals from each of the sub-forms. My question is, how do I tell the report, the stock items sub-report = 0 and not null?
Please help it's driving me crazy.

When I enter the following statement:


I get an Error message.

Also, in the query, if I say <> 0, the results do not show anything, however in my reports that field will then show up as Error in my calculations.

Do you have any ideas what I am doing wrong.

Thank you

In trying to open a report, double clicking on it from the database window, the following error message shows up. I cannot figure out why it is being generated.

Error message:
The expression on open you entered as the event property setting produced the follow error:.
*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.

Here is the code behind the report:

Option Compare Database
Option Explicit

'I have commented out all other code in the module including the on no data event.

Private Sub Report_Open(Cancel As Integer)
Dim recSrc As String

recSrc = "SELECT * FROM [YearEndAcctRecQuery] WHERE ([YearEndAcctRecQuery].[DateSold] >= #1/1/2001# AND [YearEndAcctRecQuery].[DateSold] <= #1/1/2002#) AND [Recieved] = False;"
Me.RecordSource = recSrc
End Sub

When I paste the sql into a new query and run it, it works just fine and returns records. I also re-did the whole event procedure, (deleted [Event Procedure] from the onOpen event and started over) and that did not help either.

Any help would be greatly appreciated, I am tearing my hair out!!


Created a Query that uses same field names, i.e Title, Forename and Surname.

The query handles this no problem. However trying to join the fields together and getting a syntax error. I believe the problem is the way Access views same field names but different forms.


The formula I have used is [Distributor.Title] & " " & [Distributor.Forename] & " " & [Distributor.Surname]

However you run the report and it views the formula like [[Distributor].[Title] & " " & [Distributor].[Forename] & " " & [Distributor].[Surname]]

How do I stop it from doing this?

Hi everyone,

I'm working on a new and complicated report that has two subreports in it. Everything is linked and set up right but there's one annoying problem. I have a field on my Main Form that is linked to a field in a subform. Not every record on my main form has a corresponding record on the subform. So half of the records get (#Error) messages in them when there is no matching record.
I'd like to have set up so that if there is no data for the field it'll just display "0". This seems like it should be relativly easy but I just can't seem to figure out.

Any Ideas would be very much appreciated.

I have created a report that contains a group footer WITHIN a group footer. I don't know if that is the cause, but when I trey to generate the report as a Data Access Page, I get the following error:
"Database is unable to create the data access page- the file you attempted to load was not recognized as HTML. You may have selected the wrong file, or tried to open a database file off of a web server"

I click OK and the error disappears. When I browse, the html is out there, but when I open it, I get:
"Microsoft JScript runtime error 'null' is null or not an object line = 126, col = 7 (line is offset from the start of the script block). Error returned from property or method call. "
WAAAY beyond me

Does the expression builder for formating in the detail section of a report work normally?

I entered the expression:

=format([Date], "mmmm d, yyyy")

I wanted to have the date come out as March 3, 2002 but I get an error message. Whats wrong with this procedure?

I have a crosstab query that generates counts for deaths (two categories - primary & secondary causes) within age ranges (generates zeros if none). The query generates the results OK. For example:

PCauseofD SCauseofD
0to10 11to21 22to30 31to49 50to69 70plus
0 0 5 0 0 1

0to10 11to21 22to30 31to49 50to69 70plus
3 0 0 3 1 0

However, when I attempt to run the report based on the query, I get the "The Microsoft Jet database engine could not execute the SQL statement because it contains a field that has an invalid data type. (Error 3169)" error. The SQL looks OK and the fact that the query works has me puzzled as to why I am getting this message upon executing the report.

Including the two group by's in the query, I have the following two fields:

group by (col heading) field:

AgeGroup: IIf([Age]<=10,"0to10",IIf([Age]>=11 And [Age]<=21,"11to21",IIf([Age]>=22 And [Age]<=30,"22to30",IIf([Age]>=31 And [Age]<=49,"31to49",IIf([Age]>=50 And [Age]<=69,"50to69",IIf([Age]>=70,"70plus"))))))

expression (value) field:

DummyField: nz(Count("x"),0)

The report has the count fields as follows:


I am not sure if this is part of the problem. Any help would be appreciated. Thank you.


If I look at my crosstab query results... they looks fine...

When I go to look at my Report that I created using the wizard that pulls from that query I get the error message below...

Quote: The Microsoft jet database engine does not recognize ‘[tblassocdegrees-exhibitdata].STATUS’ as a valid field name or expression.

Not finding an answer? Try a Google search.