Re: "You canceled the previous operation."
- From: "Steven L via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx>
- Date: Mon, 29 Aug 2005 20:25:37 GMT
Hmm, not out of the woods yet it seems. Using the code fragement you wrote
works beautifully on all fields with comboboxes, but I'm now having trouble
with the five checkboxes remaining. Unlike the comboboxes where I could just
accept the values currently in the combobox, for the checkboxes I need to set
the value equal to '1' if it's checked. So I've been using IIf functions,
which is currently giving me "too complicated to evaluate" grief.
Just for reference, the query now looks like this:
==================================================================
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].c_year)=
[Forms]![Case-Based Query]![c_year] Or [Forms]![Case-Based Query]![c_year] Is
Null)
AND
(([combined simple].c_18district)=
[Forms]![Case-Based Query]![c_18district] Or [Forms]![Case-Based Query]!
[c_18district] Is Null)
AND
(([combined simple].org_case_no)=
[Forms]![Case-Based Query]![org_case_no] Or [Forms]![Case-Based Query]!
[org_case_no] Is Null)
AND
(([combined simple].ccr)=[Forms]![Case-Based Query]![ccr] Or [Forms]![Case-
Based Query]![ccr] Is Null) AND
(([combined simple].motcode)=
[Forms]![Case-Based Query]![motcode] Or [Forms]![Case-Based Query]![motcode]
Is Null)
AND
(([combined simple].vsex)=
[Forms]![Case-Based Query]![vsex] Or [Forms]![Case-Based Query]![vsex] Is
Null)
AND
(([combined simple].vage)=
[Forms]![Case-Based Query]![vage] Or [Forms]![Case-Based Query]![vage] Is
Null)
AND
(([combined simple].offsexcode)=
[Forms]![Case-Based Query]![offsexcode] Or [Forms]![Case-Based Query]!
[offsexcode] Is Null)
AND
(([combined simple].offage)=
[Forms]![Case-Based Query]![offage] Or [Forms]![Case-Based Query]![offage] Is
Null)
AND
(([combined simple].relacode)=
[Forms]![Case-Based Query]![relacode] Or [Forms]![Case-Based Query]![relacode]
Is Null)
AND
(([combined simple].weafirea)=
[Forms]![Case-Based Query]![weafirea] Or [Forms]![Case-Based Query]![weafirea]
Is Null)
);
===============================================================
Now I'm trying to add another criteria in there for the checkboxes. I figure
I have to use the IIf function to tell the query to set [combined simple].
viet_camp to '1' (values for viet_camp are stored as text) if [Forms]![Case-
Based Query]![viet_camp] is -1. So far it works fine when the box is checked,
i.e. assigning the value '1' works. However, when I don't check the box I
can't seem to bring up the records with empty strings for viet_camp. So far
I've tried:
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[combined simple].viet_camp]
)
----> Gives results where viet_camp equals 0 or 1, but not zero string values
(viet_camp can have values of "0", "1" and "").
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[Forms]![Case-Based Query]!
[viet_camp])
----> Gives results where viet_camp=0. [Forms]![Case-Based Query]![viet_camp]
will, of course, only give values -1 and 0, so I can see why only the 0
results are coming up.
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[Forms]![Case-Based Query]!
[viet_camp] Or [Forms]![Case-Based Query]![viet_camp] Is Null)
----> "Too complex to be evaluated"
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[Forms]![Case-Based Query]!
[viet_camp] Is Null)
----> Again, "too complex to be evaluated"
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',Null)
----> Returned no records whatsoever.
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[combined simple].viet_camp
Or [combined simple].viet_camp] Is Null)
----> "too complicated to be evaluated"
[combined simple].viet_camp=
IIf([Forms]![Case-Based Query]![viet_camp]=-1,'1',[combined simple].viet_camp
Or "")
----> "too complicated to be evaluated"
Any way I can force the query to include the records where viet_camp is an
empty string?
Thanks again for all the help.
Steve
P.S. The typo's really my fault for using names with spaces in them. This is
my first Access project and I find myself putting spaces in names simply
because I can. Ugly habit, I know.
P.P.S. This query is killing my comp's memory. I now can only edit it through
sql view as apparently there's not enough memory to view it in design view.
Doesn't particularly bother me though, I prefer the sql view, but I hope it
doesn't bring the whole database crashing down some day...
John Spencer (MVP) wrote:
>HOOORAY!!!
>
>Sorry about the typo. I do that. Part of the reason is that I avoid object
>names with spaces and special characters. That way I can get away with not
>using the [] around items.
>
>> SCRATH THAT! Works now!
>>
>[quoted text clipped - 45 lines]
>> >>> > >WHERE (MotCode = [Forms]![Case-Based Query]![motcode] OR
>> >>> > >[Forms]![Case-BasedQuery]![motcode] is Null) ...
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200508/1
.
- Follow-Ups:
- Re: "You canceled the previous operation."
- From: John Spencer (MVP)
- Re: "You canceled the previous operation."
- References:
- "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: John Spencer (MVP)
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: John Spencer (MVP)
- Re: "You canceled the previous operation."
- From: John Spencer (MVP)
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: Steven L via AccessMonster.com
- Re: "You canceled the previous operation."
- From: John Spencer (MVP)
- "You canceled the previous operation."
- Prev by Date: simple or not
- Next by Date: date formats
- Previous by thread: Re: "You canceled the previous operation."
- Next by thread: Re: "You canceled the previous operation."
- Index(es):