Hi Allen,
Thanks for the reply.
I changed the WHERE line as you suggested but no luck. When I change to
Datasheet view I get a pop-up asking for MyFied value. I have posted the SQL
as I have probably typed something wrong?
Hope you can assist
Nick
SELECT [qSamples-1].SampleID, [qSamples-1].CHECKED,
[qSamples-1].GREASE_SAMPLE, [qSamples-1].OIL_SAMPLE, [qSamples-1].VA,
[qSamples-1].FLOC_ID, [qSamples-1].BHP_EQ, [qSamples-1].VA_CODE,
[qSamples-1].Transfered, [qSamples-1].FLOC_DESCRIPTION,
[qSamples-1].MAINTPLANT, [qSamples-1].[COST CENTER], [qSamples-1].[CATALOG
PROFILE], [qSamples-1].OILTYPE, [qSamples-1].FillQuantity, [qSamples-1].s,
[qSamples-1].[Select]
FROM [qSamples-1]
WHERE ([Forms]![frmSystem]![frmSystemSub].[Form]![Select]=False) OR
(MyField=True)
ORDER BY [qSamples-1].FLOC_ID;
Allen Browne said:
If the check box is unchecked (False), you want all records returned.
If it is checked (True), you want to return only the records where MyField
is True.
Switch your query to SQL View (View menu, in query design).
Change the WHERE clause so it looks like this:
WHERE ([Forms]![frmSystem]![frmSystemSub].[Form]![Select] = False) OR
(MyField = True)
If the check box is unchecked, the first part returns True, so the WHERE
clause evaluates to True, and if the WHERE clause evaluates to True for all
records then all records are returned. If the check box is checked, then
the WHERE clause returns True only for those records where MyField is True,
so only those records are returned.
The .Form bit helps Access understand the refererence (especially Access
2003.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
I have a query where one of the fields is a check box, [Select]. The
criteria
comes from a subform in datasheet view
[Forms]![frmSystem]![frmSystemSub]![Select]
I the created another field in the query
Expr1:[Forms]![frmSystem]![frmSystemSub]![Select] and the criteria is
False.
This works sometimes.
So what I'm trying to achieve is if [Select] check box is blank all
records
are returned but if some are checked only those are displayed after
up-date.
Any help appreciated.
Nick