Re: Update Query - Advice sought
- From: "Van T. Dinh" <VanThien.Dinh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 17 Apr 2006 20:58:27 +1000
In the Update To cell of the 'Name' column, use the expression:
IIf( ([Date] >= date1) And ([Date] <= date2), "X",
IIf( ([Date] >= date3) And ([Date] <= date4), "Y",
IIf( ([Date] >= date5) And ([Date] <= date6), "Y", [Name])
(type as ONE line in the cell.)
Note: if you use explicit date values (for date1 ... date6), they must be
expressed in the US format "mm/dd/yyyy" (or an internationally unambiguos
format like "yyyy-mm-dd") and enclosed in hashes (#).
Once you get it to work, switch to SQL view to view the constructed SQL and
learn how to read / write SQL as it is easier to communicate in these
newsgroups using SQL.
--
HTH
Van T. Dinh
MVP (Access)
"Jason O" <zeugma@xxxxxxxxxxxxxx> wrote in message
news:C0691F39.6B2C%zeugma@xxxxxxxxxxxxxxxxx
Hi
I just wondered if someone could advise me if and how something could be
done. Let's say I have just 2 fields - 'Date' and 'Name'. I want an
update
query to do the following:
Update 'Name' to 'X' if 'Date' between date1 and date2
Update 'Name' to 'Y' if 'Date' between date3 and date4
Update 'Name' to 'Z' if 'Date' between date5 and date6
I can do the first step easy enough, but wanted to do the other steps in
the
same query. Is this possible? I have a few to do so didn't want a separate
update query for each.
If anyone could point me in the right direction that'd be great. Oh, in
design view if possible, rather than sql :-)
Many TIA,
Jay
___
.
- Follow-Ups:
- Re: Update Query - Advice sought
- From: Jason O
- Re: Update Query - Advice sought
- References:
- Update Query - Advice sought
- From: Jason O
- Update Query - Advice sought
- Prev by Date: Update Query - Advice sought
- Next by Date: Re: Custom Colors Not Saved
- Previous by thread: Update Query - Advice sought
- Next by thread: Re: Update Query - Advice sought
- Index(es):
Relevant Pages
|