Re: IIf problem with <>

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Steve,

I assume that your checkbox is in the header, and basically, what you want
is to either turn off the filter or turn it on. Is that correct? If so, I
would put the following code in the checkboxes AfterUpdate event.

Private sub ShowComplete_AfterUpdate

If me.ShowComplete = True then
me.filter = "[Status] = 'Complete'"
me.filteron = true
Else
me.Filter = ""
me.Filteron = False
endif

End sub

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Steve" wrote:

I dont understand what you are saying as it seems simple enough but the iif
statment just dont seem to want to accept the not the same as the word
Complete which is a value that is in the field being checked.
the field has only three possabilities Complete,Working,Checked

the form is set to Continuous Forms and all I want to be able to to is
filter out the records that have been completed by changing its recourd
source to the query. selecting a tick box that indicates show completed jobs
or show all jobs and I would have though the iif statment would have done it.
Regards
Steve
from a land down under

"Marshall Barton" wrote:

Steve wrote:

Hi can anybody please tell me why this query criteria does not work.
IIf([Forms]![RegisterFrm]![ShowComplete]=True,[RegisterTbl]![Status],<>"Complete")

I have a tick box on a form called ShowComplete that can be set to true or
false
when it is set to true I want it to show all records no matter what is in
the status field. but if the tick box is set to false I want all records
except the records with the word "Complete" to show. what have I done wrong
in the iif statement.


You are trying to construct a criteria cell for the query
designer. That really doesn't make sense when the query is
executed where a function returns a **value**, not part of
an expression.

Try setting the field's criteria:

RegisterTbl.Status Or Forms!RegisterFrm!ShowComplete=True

--
Marsh
MVP [MS Access]

.



Relevant Pages

  • Re: Creating a temporary table/query for subform
    ... What this table will do is summarize the data they've filtered and then ... "Percent") change depending on what the users want to filter. ... I also need to label each checkbox field to something usable for the ... and I believe that requires a table or a query. ...
    (microsoft.public.access.queries)
  • Re: Use Select query as LinkCriteria with OpenForm method?
    ... You have a form with a checkbox on it ... I thought that by including my query as part of the string ... The filter is ... > qselFilterPests the other fields on the form will not have anything to link ...
    (microsoft.public.access.queries)
  • Creating a query using existing attributes
    ... to create a query that would prompt the user to select the specific ... attributes to filter the data that they want to view. ... to have to enter the attributes each time but simply click on the checkbox ...
    (microsoft.public.access.queries)
  • report generating duplicates
    ... I've written a query that will ... filter out all records except duplicates. ... continuously, preceded by a checkbox. ...
    (microsoft.public.access.formscoding)
  • Please Help: Cannot UPDATE a table based on a query
    ... the above would be an UPDATE query not *code* as you indicated ... "Gina Whipp" wrote: ... then filter the records to get even more specific records. ...
    (microsoft.public.access.formscoding)