I have a query that gives me the "3071 - Expression too complex to be evaluated.." error. The problem is I can get the EXACT same SQL to run and not produce the error. The query is part of a reporting tool that hundreds of users run (each on their own instance or a few people sharing one instance).
Here's the flow of what I do:
1 - Open DB
2 - run query
3 - Query dies w/ "3071 - Expression too complex..." error
4 - open query in SQL edit mode
5 - Rerun query and it works fine.
6 - Scratch head and curse loudly....
After modifying the query it works for a random amount of time and users don't complain. Then all of the sudden, it starts failing again, and I repeat the query edit, resave and it works fine until the next time. The problem is I never know what may or may not fix it because it will work fine after opening in edit mode. I've tried compact/repair and that has no effect on the query. The only thing that fixes it is opening it in design mode.
I need to figure out what is the root cause of this. I'm getting sick of fixing it with my edit/resave hack. It's not excessively complex or anything.
Here's my SQL. It uses some form value references in the criteria, but the form is open and values exist when I'm trying to run the query, so that shouldn't be it.
SELECT [VARIANCE DIVISION].MONTHNBR,
CHOOSE([MONTHNBR],"January","February","March","April",
"May","June","July","August","September",
"October","November","December") AS MTHNAME,
[VARIANCE DIVISION].INVTYPE,
[VARIANCE DIVISION].TRFTYPE,
[VARIANCE DIVISION].DIV_CODE,
[VARIANCE DIVISION].DIV_DESC,
[VARIANCE DIVISION].LED,
[VARIANCE DIVISION].MATL,
[VARIANCE DIVISION].SOURCEDIVCODE,
[VARIANCE DIVISION].SOURCEDIVDESC,
[VARIANCE DIVISION].SOURCESUBP,
[VARIANCE DIVISION].BASE,
[VARIANCE DIVISION].TYPE,
[VARIANCE DIVISION].PCT,
[VARIANCE DIVISION].CYMTHPRICE AS CYPRICE,
[VARIANCE DIVISION].LYPRICE,
[VARIANCE DIVISION].CYADJQTY,
[VARIANCE DIVISION].CYADJVAL,
[VARIANCE DIVISION].MTHVARIANCE AS VARIANCE,
[VARIANCE DIVISION].CYYTDPRICE AS CYTDPRICE,
[VARIANCE DIVISION].LYTDPRICE,
[VARIANCE DIVISION].CYTDADJQTY,
[VARIANCE DIVISION].CYTDADJVAL,
[VARIANCE DIVISION].YTDVARIANCE
FROM [VARIANCE DIVISION]
WHERE ((([VARIANCE DIVISION].INVTYPE) LIKE [FORMS]![REPORTMENU]![INVTYPE])
AND (([VARIANCE DIVISION].TRFTYPE) LIKE [FORMS]![REPORTMENU]![TRFTYPE])
AND (([VARIANCE DIVISION].DIV_CODE) LIKE IIF([FORMS]![REPORTMENU]![PRODCHOICE] = "2",[FORMS]![REPORTMENU]![COMM],
"*"))
AND (([VARIANCE DIVISION].CYTDADJQTY) <> "0"))
I have a strange problem I can't figure out. I have a massive query that runs off of about 10 other queries. I use [forms]![Authority].[Emp#] in the query conditions, using the supervisor's employee# to only show them the members on their team on the form.
My problem is that the query/form is working fine for most of the supervisors, but when I enter the employee number of two other supervisors, I get this error: This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.
Those two supervisors don't get the error, the form just doesn't load for them after they click on the button on the switchboard, but if I go into the database window on their pc and try to run it, the error appears.
to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
I did a search and it looks like date prompts cause this error sometimes. The message pops up when running from the Switchboard to generate a report. When you hit the button, you are prompted for the Start Date and End Date, but then this message appears.
Running the query directly, not using the Switchboard or Report to generate the data, it runs fine, still using the two prompts.
Any idea on what I should look at to resolve this issue so users can run the report from the switchboard? Let me know if I need to post the sql or something.
In my database I am trying to produce a "Statistics" function. As part of this, the user will enter a "Start Date" and "End Date" in a form and then click a button which will open the requested report with the date drawn from a query. The code on clicking the "All Jobs" button is:
I am trying to stop the user from leaving the date fields blank or entering dates outside of the range of the database so I have tried the code:
Code: Private Sub AllSalesEnquiries_Click() If Me.DateFrom = "" Then Beep If MsgBox("You have not entered a start date", vbCritical, "Start Date Not Entered") Then
[Code] ....
If the user enters dates within the range of the database the report is presented correctly.
If the user does not enter a date or enters one outside of the range it produces the correct message box however if the user then corrects the mistake I receive a Runtime Error 3071 message. Clicking "Debug" highlights the final line of code:
I know that the code is correct because it works fine as stand alone code and it works if the user enters the correct dates so I am not sure where I am going wrong.
The date format works perfectly for the way dates are formatted in the database.
"This expression is typed incorrectly or it is too complex to be evaluated….For example a numeric expression my contain too many complicated elements."
I think the error is as a result of this expression in my query, I have 9 fields with the expression below with different field names:
Like Forms!QBF_Form!Sales & "*" Or Forms!QBF_Form!Sales Is Null
The problem is when I close the query and open it, the expression multiplies to numerous rows and also creates additional fields for the last part of the expression. Is there an expression that I could use that would work okay.
I tried using this expression: Like IIF (Forms!QBF_Form!Sales)="", "*", "*" & Forms!QBF_Form!Sales & "*"
It was working, but is no longer working..not sure why.
Do you have a similar expression that will achieve the same result but create additional criteria.
The control source for the Activity Summary report in my DB is the primary data table. The report contains about 12 fields, each with a statement like this one as its control source: =Sum(Abs(Year([RecDate])=Year(Date()) And ([NotifType]=9)))
Up until yesterday afternoon the report was working just fine. But suddenly when I run the report I'm getting this error:
"The expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
I have no idea why this problem suddenly popped up when the report had been running just fine for weeks.
Here's what I've done so far to try and fix it: 1. Copied the report and gave it a new name, thinking if the report were somehow corrupt creating a new one might fix it. No such luck. 2. Tried running the report after removing each control source statement one-by-one, but the error didn't disappear until all the statements had been cleared.
Anyone have any ideas? I'm willing to post the DB if that will help.
The recordsource of a listbox is a query which is filtered by a combo box on the form. There are 4 possible groups to be viewed and the values for each group are Group 1=(Null or " "), Group2="Denied", Group3="Restricted" and Group4=("Approved" or an approval number). The query worked fine until I added the code to get Group4 by eliminating all of the other values. It is causing an 'expression too complex' error. Here is the sql for my query:
SELECT vi_AuthApproval.AuthID, nz([Approval_Number]," ") AS Approval FROM vi_AuthApproval WHERE (((nz([Approval_Number]," "))=IIf([Forms]![frmAuthApprovList]![cboApproval]="Approved",(nz([Approval_Number]," "))<>" " And (nz([Approval_Number]," "))<>"Denied" And (nz([Approval_Number]," "))<>"Restricted",[Forms]![frmAuthApprovList]![cboApproval])));
Can someone help me simlify the query or point me in another direction to accomplish this?
I am getting this error "This expression is typed incorrectly, or is too complex to be evaluated"
For this query: SELECT first([TblProp].[Name]) AS [SName], First([TblProp].[CommentDate]) AS DateCommented, First([TblProp].[No]) AS BNum, First([TblProp].[Indication]) AS Ind, First([TblProp].[PropSubmitted]) AS DateSub, First([TblProp].[Contact]) AS PrimCon, First([TblProp].[Prepared]) AS PrepName, First([TblProp].[Comment]) AS Comment,First([TblProp].[Value]) AS ValueNew, First([TblProp].[Rating]) AS Prob FROM TblProp GROUP BY [TblProp].[RFPNo];
This query had been working fine for a good long time, but suddenly it starts throwing up this message. I haven't changed anything at all with this query. Its very puzzling. I went through each of the fields and its the comment field that is causing the problem.
Would anyone have any ideas on why this might be happening?
I have an Access application that print a report with 7 sub-reports in it. When I preview the report, it looks fine. When I print it directly to the printer, it looks fine. The problem is when I print from the preview, Access error with a "...too complex..." error and crashes the application.
I have a simple query to calcualte a profit margin on daily sales lines and I use a quick and dirty expression to calculate the margin in the query so I never need to drill it down further than that level (I don't want to go as far as putting the output into a report as it is only for use when double checking lines for errors which get fixed there and then in the database).
So far so good, however the margin output is a bit awkward to read as I can't seem to format it as a simple percentage. The field properties page doesn't like doing anything with the expression and even typing in a format manually has no effect, so I end up with figures like
Is there any way to format this output to show only 1-2 decimal places and be in a proper number format so I can sort them in ascending order properly?
I am getting some error with this querry. It gives me an error saying "Too few parameters"....can anybody tell me what exactly is wrong in this???
"SELECT id_indicateur FROM processus_indicateur,processus_projet WHERE [processus_indicateur].id_processus = [processus_projet].id_processus AND processus_projet.id_projet='" & cmb_projet.Value & "' AND indicateur.id_periodicite= '& idper' "
"This expression is typed incorrectly, or it is too complex to be evaluated For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
Below is my SQL for this query:
SELECT DISTINCTROW [OI Category Aging Query].[Age List], [OI Category Aging Query].[Reporting Entity], Sum([OI Category Aging Query].[Accrual $]) AS [Sum Of Accrual $], Sum([OI Category Aging Query].Unearned) AS [Sum Of Unearned] FROM [OI Category Aging Query] GROUP BY [OI Category Aging Query].[Age List], [OI Category Aging Query].[Reporting Entity];
It's just a simple query to sum up two columns from another query. This query is for an OI Category Aging report, and I have another MI Category Aging report that is working perfectly fine. They almost mirror each other, except for a few calculation differences. They both start from the same table. And my OI Category Aging Query seems to be working just fine. I cannot find any errors or N/A's in either the Accrual $ column or the Unearned column. Any suggestions on what to do or where to go from here? A simple sum on only the Accrual $ column or the Unearned column doesn't work either.
The OI Category Aging Query is 198,711 rows, so I can't drop it into excel.
I am trying to create a expression to calculate the net fine of a book by the expression below by using a query:
Net Fine: IIf(DateDiff("d",[Issue Date],Date())>7 And [Returned]=True,(DateDiff("d",[Issue Date],Date())-7)*15,"0")
The returned field is a checkbox. The expression works but the record keeps updating and as a result the net fine increases everyday. So is there any way to keep the fine from increasing. I know then problem is occuring due to the usage of Date(). And I dont want use VB for this task. And is there any way to set its data type to currency.
I am trying to get some of my colleagues to open a database I have created. They keep getting an error message on some of my forms:
"The expression after update you entered as the event property setting produced the following error – can’t find project or library 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 an event, function or macro."
What does this mean? I'm assuming it has osmething to do with the code I have in AfterUpdate events but these are only requerys for cascading combos. Example:
Private Sub cboBusiness_AfterUpdate() Me.cboBusinessUnit.Requery Me.cboBusinessUnit.SetFocus End Sub
Where do I need to look to sort this? It works fine on my PC, but nobody elses.
I created an expression in my query, when I run the report or try to go into it the design view I get the following error message: The expression you entered exceeds the 1024-character limit for the query design grid.
I need to implement the following logic in a report column:
IF hist_mis_cds!typgess = "", then calculated field= "" ELSE IF hist_mis_cds!typgess <> hist_code_translation! src_code_desc then calculated field= "X" ELSE calculated field= ""
I have implemented the following query in Expression Builder for the calculated field:
I need to implement the following logic in a report column:
IF hist_mis_cds!typgess = "", then calculated field= "" ELSE IF hist_mis_cds!typgess <> hist_code_translation! src_code_desc then calculated field= "X" ELSE calculated field= ""
I have implemented the following query in Expression Builder for the calculated field:
I currently have a combo list on a purchase order form that has the following event procedure(s) in it so as to open the inventory window as needed to add/edit inventory.
Not in List: Private Sub Combo55_NotInList(NewData As String, Response As Integer) MsgBox "ERROR: ITEM not in list. Double-click this field to add an entry to the list." Response = acDataErrContinue End Sub
On Double-Click: Private Sub Combo55_DblClick(Cancel As Integer) On Error GoTo Err_Combo55_DblClick Dim lngCombo55 As Long
If IsNull(Me![Combo55]) Then Me![Combo55].Text = "" Else lngCombo55 = Me![Combo55] Me![Combo55] = Null End If DoCmd.OpenForm "INVENTORYITEMSform", , , , , acDialog, "GotoNew" Me![Combo55].Requery If lngCombo55 <> 0 Then Me![Combo55] = lngCombo55
This works GREAT on other forms I have however, on this particular form it gives me the following error:
ERROR: You have tried to assign the null value to a variable that is not a variable data type.
I have started from scratch several times....can anyone help? Is there anyway to add a button to the form to open the inventory form and then requery the combo box when closing the inventory form?
I've managed to create an access-database and (fill it with some data), retrieve data from it with asp, but when I try to insert or update data with asp, I get the same error:
"Syntax-error in Insert expression" or "Syntax-error in update expression"
Do I have to "chmod" the database to write to it, or what?
(I usually work with sql-databases, and the code/syntax I believe is not wrong,as it works on another database) Conn.Execute("INSERT INTO tour(date,venue,city,link) VALUES('" & datum & "','" & venue & "','" & city & "','" & link & "')")
We use Microsoft Access databases to enter test data and eventually generate reports.
On 1 computers i get the following error when opening the report:
"Function is not available in expressions in query expression 'Left(.....)"
I figured this is a reference problem so the next thing i did was to pinpoint what reference was causing this error.
It turns out it is the Microsoft DAO 3.6 Object Library. Simply removing the reference and adding it again fixes it and allows you to open reports just fine.
The problem is though, this message comes back every now and then. Which is getting annoying and the person who is making the reports is about to throw his computer out of the window.
Created a form that requires daily work flow info to be entered. Tested the form accepting random typos like "%, # ! etc... Worked just fine. In production received the following long error:"The expression On Click you entered as the event property setting produced the following error: Expression may not result in the name of macro, user defined function or event procedure".
I have 5 different tables that are all linked with foreign keys. When I made my fifth table and linked it to my primary key like I had with the other tables I got the Join expression not supported error.
Hello, first time posting, not sure what info you all need. I'm looking for some help with an if/then statement in access query involving dates. Below is the query I am trying to use, along with the error message. Any ideas?
Domestic Violence CME Required?: IIf(([Date of Next Medical License Renewal]-[Date of Last Domestic Violence Credit (2)])>("yyyy",6),"yes","no")
syntax error (comma) in query expression 'IIf(([Date of Next Medical License Renewal]-[Date of Last Domestic Violence Credit (2)])>("yyyy",6),"yes","no")'
The error seems to be in relationship to the number 6. I want a "yes" to show up in the field if the difference is greater then 6 years.
Hello I'm having trouble getting my nested Iif statement to run. Can anyone help??? I've attached a screen shot of the syntax error that I'm receiving. The example code below needs tweaking.
Update [Goodrec-copy3] set [Goodrec-copy3].shortname = Iif (Not Null([shortname]),[Goodrec-copy3].shortname Like "*,JR*" Or ([Goodrec-copy3].[shortname] Like "*, SR*" Or ([Goodrec-copy3].[shortname]) Like "*, II*" Or [Goodrec-copy3].[shortname]) Like "*, III*", InStrRev([shortname])," ",InStr([shortname]," ,")+1,50) &" "& Left([shortname],InStrRev([shortname])," ,")-1) WHERE ((([Goodrec-copy3].[ctype])="I"));
What I'm attempting to accomplish with this query is to keep the field shortname the same if not null and if it doesn't meet the criteria of having a string value of "JR", "SR", "II", or "III". If the field does have a string value of "JR", "SR", "II", or "III" reverse the string (example John Gissom JR) to reflect shortname as such for example: "Gissom JR John".
This error message keeps popping up no matter what I do. "Database can't find the field 'QuotationNumber' referred to in your expression." I tried to define a text box by using a DLookUp function, however that did not work. I deleted the function, and now this error message keeps popping up. I have searched everywhere for an expression with 'QuotationNumber' in it, and I cannot find it. What do I do?