473,287 Members | 3,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

The expression is typed incorrectly.

I have a db with a bit of yes/no/na drop downs. I have those drop downs pulled into queries to produce the % for each of the records. Everything is fine and dandy till I try to pull a report that has a "N/A" as an answer in the table. It then gives me this error "This expression is typed incorrectly, or is to complex to evaluated...blah blah blah"

I gather my numbers for "Yes" with this expression:
Expand|Select|Wrap|Line Numbers
  1. CfsQ1_Yes: Switch(tbl_Data!CfsQ1="Yes",1,tbl_Data!CfsQ1="No",0,tbl_Data!CfsQ1="N/A",0)
My numbers for No/na are gathered together as "opportunities" and here is that expression.
Expand|Select|Wrap|Line Numbers
  1. CfsQ1_Ops: Switch(tbl_Data!CfsQ1="Yes",1,tbl_Data!CfsQ1="No",1,tbl_Data!CfsQ1="N/A",0)
Then I have 2 respective queries to take the Sums and finally a query that out puts my final %. My final query that outputs my % looks like this.
Expand|Select|Wrap|Line Numbers
  1. CfsQ1: FormatPercent(qry_SumOfQ_Yes_Count!SumOfCfsQ1_Yes/qry_SumOfQ_Ops_Count!SumOfCfsQ1_Ops,2)
Soooooooooo.....in a nutshell. 2 qrys to turn my yes/no/na's to numbers. 2 qrys to add them. one qry to output my %. If you're tracking so far, my question is. Why won't my report run with a N/A as a selection? It works perfectly with yes/no in the table. As soon as the n/a is saved in the table....it hacks up.

Thank you graciously
May 28 '10 #1
7 2011
ChipR
1,287 Expert 1GB
It may be a good idea to separate the functions to see what's working and what isn't. Do the individual queries work before you try to open the report?
May 28 '10 #2
ChipR
1,287 Expert 1GB
Also, what is the actual type of the field you are operating on? A text field where you only allow "Yes", "No", "N/A"? This error may be the result of mixing types or trying to operate on null values.

Your second bit of code counts "Yes" and "No" as 1. Is this intentional?

Are you trying to print a ratio or a percentage of the total? Either way, you must avoid dividing by zero.
May 28 '10 #3
@ChipR
The yes/no/na are a drop down menu. And yes it is intentional that way it can do the math when the yes and the ops are calculated. I've narrowed it down to my final query though. All my other querys work out fine with the n/a value.

Here is my code again for the final query.
Expand|Select|Wrap|Line Numbers
  1. CfsQ1: FormatPercent(qry_SumOfQ_Yes_Count!SumOfCfsQ1_Yes/qry_SumOfQ_Ops_Count!SumOfCfsQ1_Ops,2)
Can't pinpoint why my troubles are.
May 28 '10 #4
ChipR
1,287 Expert 1GB
It sounds like the field in your table is set to use a Display Control of Combo Box. What is the data type for your field, and what is the source for the Combo Box values?
May 28 '10 #5
@ChipR
All of my yes/no/na are combo boxes and are set as "text" in the data field. Right now I am retracing my steps to see if I left anything out or possibly have a wondering char. somewhere. I've went back in to previous db's that use the same priciple to see if I have slipped up somewhere. Only conclusion thus far is my n/a's aren't poducing a 0 somewhere and it's kicking back as Null
May 28 '10 #6
ChipR
1,287 Expert 1GB
Just to double check,
qry_SumOfQ_Ops_Count!SumOfCfsQ1_Ops
is not in any case equal to zero?
May 28 '10 #7
@ChipR
Geeeeeeeeze.......I can't believe I missed this. I had a stray field in my last qry that produced my percentages with an expression not pointing to anything. I must have gotten in a rush doing this. That you so much for your time Sir, it is greatly appreciated!
May 28 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

39
by: | last post by:
I am trying to run the following agregate function in a parameterized query on Access2000: Min(.*sqr(./.)/) The query saved OK, but an attempt to run it results in the message: The expression...
14
by: cvollberg via AccessMonster.com | last post by:
Good morning, I need a little help, I keep getting this error when I run this report. I have narrowed it down to the query (sql view) listed below. the error is: "This expression is typed...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.