S
Steven L via AccessMonster.com
I've got a form with some comboboxes, five checkboxs and a command button on
it. The command button simply launches a query.
I'm getting some very strange behaviour:
When I check the first checkbox the query runs fine. However, checking any of
the subsubsequent four checkboxes throws up a "You canceled the previous
operation." error. I read around these forums but wasn't able to find
anything that solves the problem. I've compact & repaired, decompiled and
created and imported into a new database, but still get the same error.
I fiddled around a little more and found that if I checked one of the problem
checkboxes but then instead of hitting the command button, opened the query
from the queries menu, I got this error message instead:
"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."
I'll admit the query is kinda ugly, but I'm really not sure how I can
simplify it. I've listed the query below. The five checkboxes are:
Forms]![Case-Based Query]![viet_camp]
Forms]![Case-Based Query]![c_rob_bur_c]
Forms]![Case-Based Query]![vic_nonc]
Forms]![Case-Based Query]![offchi]
Forms]![Case-Based Query]![sex_as_c]
and the rest are comboboxes
As for the IIf monkey business, it basically says if the the combobox isn't
empty then take that value, else take all the possible values that field can
have (and also null)
=====================================================================
SELECT
[combined simple].org_case_no,
[combined simple].ccr,
[combined simple].c_year,
[combined simple].c_18district,
[combined simple].motcode,
[combined simple].vsex,
[combined simple].vage,
[combined simple].offsexcode,
[combined simple].offage,
[combined simple].relacode,
[combined simple].viet_camp,
[combined simple].c_rob_bur_c,
[combined simple].vic_nonc,
[combined simple].offchi,
[combined simple].sex_as_c,
[combined simple].weafirea,
[combined simple].ID
FROM [combined simple]
WHERE
((([combined simple].org_case_no)=IIf([Forms]![Case-Based Query]![org_case_no]
Is Not Null,[Forms]![Case-Based Query]![org_case_no],([combined simple].
[org_case_no]) & Null))
AND (([combined simple].ccr)=IIf([Forms]![Case-Based Query]![ccr] Is Not Null,
[Forms]![Case-Based Query]![ccr],([combined simple].[ccr]) & Null))
AND (([combined simple].c_year)=IIf([Forms]![Case-Based Query]![c_year] Is
Not Null,[Forms]![Case-Based Query]![c_year],([combined simple].[c_year]) &
Null))
AND (([combined simple].c_18district)=IIf([Forms]![Case-Based Query]!
[c_18district] Is Not Null,[Forms]![Case-Based Query]![c_18district],(
[combined simple].[c_18district]) & Null))
AND (([combined simple].motcode)=IIf([Forms]![Case-Based Query]![motcode] Is
Not Null,[Forms]![Case-Based Query]![motcode],([combined simple].[motcode]) &
Null))
AND (([combined simple].vsex)=IIf([Forms]![Case-Based Query]![vsex] Is Not
Null,[Forms]![Case-Based Query]![vsex],([combined simple].[vsex]) & Null))
AND (([combined simple].vage)=IIf([Forms]![Case-Based Query]![vage] Is Not
Null,[Forms]![Case-Based Query]![vage],([combined simple].[vage]) & Null))
AND (([combined simple].offsexcode)=IIf([Forms]![Case-Based Query]!
[offsexcode] Is Not Null,[Forms]![Case-Based Query]![offsexcode],([combined
simple].[offsexcode]) & Null))
AND (([combined simple].offage)=IIf([Forms]![Case-Based Query]![offage] Is
Not Null,[Forms]![Case-Based Query]![offage],([combined simple].[offage]) &
Null))
AND (([combined simple].relacode)=IIf([Forms]![Case-Based Query]![relacode]
Is Not Null,[Forms]![Case-Based Query]![relacode],([combined simple].
[relacode]) & Null))
AND (([combined simple].viet_camp)=IIf([Forms]![Case-Based Query]![viet_camp]
=-1,'1',([combined simple].[viet_camp]) & Null)) AND (([combined simple].
c_rob_bur_c)=IIf([Forms]![Case-Based Query]![c_rob_bur_c]=-1,'1',([combined
simple].[c_rob_bur_c]) & Null))
AND (([combined simple].vic_nonc)=IIf([Forms]![Case-Based Query]![vic_nonc]=-
1,'1',([combined simple].[vic_nonc]) & Null)) AND (([combined simple].offchi)
=IIf([Forms]![Case-Based Query]![offchi]=-1,'1',([combined simple].[offchi])
& Null))
AND (([combined simple].sex_as_c)=IIf([Forms]![Case-Based Query]![sex_as_c]=-
1,'1',([combined simple].[sex_as_c]) & Null))
AND (([combined simple].weafirea)=IIf([Forms]![Case-Based Query]![weafirea]
Is Not Null,[Forms]![Case-Based Query]![weafirea],([combined simple].
[weafirea]) & Null)));
it. The command button simply launches a query.
I'm getting some very strange behaviour:
When I check the first checkbox the query runs fine. However, checking any of
the subsubsequent four checkboxes throws up a "You canceled the previous
operation." error. I read around these forums but wasn't able to find
anything that solves the problem. I've compact & repaired, decompiled and
created and imported into a new database, but still get the same error.
I fiddled around a little more and found that if I checked one of the problem
checkboxes but then instead of hitting the command button, opened the query
from the queries menu, I got this error message instead:
"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."
I'll admit the query is kinda ugly, but I'm really not sure how I can
simplify it. I've listed the query below. The five checkboxes are:
Forms]![Case-Based Query]![viet_camp]
Forms]![Case-Based Query]![c_rob_bur_c]
Forms]![Case-Based Query]![vic_nonc]
Forms]![Case-Based Query]![offchi]
Forms]![Case-Based Query]![sex_as_c]
and the rest are comboboxes
As for the IIf monkey business, it basically says if the the combobox isn't
empty then take that value, else take all the possible values that field can
have (and also null)
=====================================================================
SELECT
[combined simple].org_case_no,
[combined simple].ccr,
[combined simple].c_year,
[combined simple].c_18district,
[combined simple].motcode,
[combined simple].vsex,
[combined simple].vage,
[combined simple].offsexcode,
[combined simple].offage,
[combined simple].relacode,
[combined simple].viet_camp,
[combined simple].c_rob_bur_c,
[combined simple].vic_nonc,
[combined simple].offchi,
[combined simple].sex_as_c,
[combined simple].weafirea,
[combined simple].ID
FROM [combined simple]
WHERE
((([combined simple].org_case_no)=IIf([Forms]![Case-Based Query]![org_case_no]
Is Not Null,[Forms]![Case-Based Query]![org_case_no],([combined simple].
[org_case_no]) & Null))
AND (([combined simple].ccr)=IIf([Forms]![Case-Based Query]![ccr] Is Not Null,
[Forms]![Case-Based Query]![ccr],([combined simple].[ccr]) & Null))
AND (([combined simple].c_year)=IIf([Forms]![Case-Based Query]![c_year] Is
Not Null,[Forms]![Case-Based Query]![c_year],([combined simple].[c_year]) &
Null))
AND (([combined simple].c_18district)=IIf([Forms]![Case-Based Query]!
[c_18district] Is Not Null,[Forms]![Case-Based Query]![c_18district],(
[combined simple].[c_18district]) & Null))
AND (([combined simple].motcode)=IIf([Forms]![Case-Based Query]![motcode] Is
Not Null,[Forms]![Case-Based Query]![motcode],([combined simple].[motcode]) &
Null))
AND (([combined simple].vsex)=IIf([Forms]![Case-Based Query]![vsex] Is Not
Null,[Forms]![Case-Based Query]![vsex],([combined simple].[vsex]) & Null))
AND (([combined simple].vage)=IIf([Forms]![Case-Based Query]![vage] Is Not
Null,[Forms]![Case-Based Query]![vage],([combined simple].[vage]) & Null))
AND (([combined simple].offsexcode)=IIf([Forms]![Case-Based Query]!
[offsexcode] Is Not Null,[Forms]![Case-Based Query]![offsexcode],([combined
simple].[offsexcode]) & Null))
AND (([combined simple].offage)=IIf([Forms]![Case-Based Query]![offage] Is
Not Null,[Forms]![Case-Based Query]![offage],([combined simple].[offage]) &
Null))
AND (([combined simple].relacode)=IIf([Forms]![Case-Based Query]![relacode]
Is Not Null,[Forms]![Case-Based Query]![relacode],([combined simple].
[relacode]) & Null))
AND (([combined simple].viet_camp)=IIf([Forms]![Case-Based Query]![viet_camp]
=-1,'1',([combined simple].[viet_camp]) & Null)) AND (([combined simple].
c_rob_bur_c)=IIf([Forms]![Case-Based Query]![c_rob_bur_c]=-1,'1',([combined
simple].[c_rob_bur_c]) & Null))
AND (([combined simple].vic_nonc)=IIf([Forms]![Case-Based Query]![vic_nonc]=-
1,'1',([combined simple].[vic_nonc]) & Null)) AND (([combined simple].offchi)
=IIf([Forms]![Case-Based Query]![offchi]=-1,'1',([combined simple].[offchi])
& Null))
AND (([combined simple].sex_as_c)=IIf([Forms]![Case-Based Query]![sex_as_c]=-
1,'1',([combined simple].[sex_as_c]) & Null))
AND (([combined simple].weafirea)=IIf([Forms]![Case-Based Query]![weafirea]
Is Not Null,[Forms]![Case-Based Query]![weafirea],([combined simple].
[weafirea]) & Null)));