473,480 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update Query / Multiple criteria - MSAccess 2010

15 New Member
I have created an update query to auto populate the value of one field based on the value of another field.

I have two fields "Level" and "Document"

if Document is A, Level needs to be 1
if Document is B, Level needs to be 2
if Document is C, Level needs to be 3

as far as I can see the GUI only lets you enter one criteria, but I am sure there is a way to avoid three different update queries and do it all in one, any suggestions?
Jan 10 '13 #1
3 4160
NeoPa
32,556 Recognized Expert Moderator MVP
You could use the Switch() function :
Expand|Select|Wrap|Line Numbers
  1. UPDATE [YourTable]
  2. SET    [Level]=Switch([Document]='A',1,[Document]='B',2,True,3)
Jan 10 '13 #2
M0ji
15 New Member
It worked great
Thanks
Jan 11 '13 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Although since this field seems to be derived from the other field, you may not want to store it and calculate it as needed.
Jan 11 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
13188
by: Don Seckler | last post by:
I have an update query that runs when a report closes. I have several reports that will need to run the update query with diferent criteria. I'd like to simply make the criteria change in the...
0
1911
by: Dalan | last post by:
I'm not certain if this is doable in the manner explained below, but I'm certain that there have been Access developers who have done something similar. So whatever insight and assistance that can...
1
1688
by: cong ngo | last post by:
Hi all If have table with the records below and these data need to be update to another table by the name field. name phone fax emal ted 619 mary 855
1
3791
by: meyvn77 | last post by:
I'm new to adp w/ sql server but I have to use it on a project i'm doing... One of the MUSTS for this project is the ability to update a 00 - 09 text value with the appropriate text description...
0
2445
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
2
535
by: NigelMThomas | last post by:
I have an especially challenging problem. I know there are a few geniuses in this group so perhaps; you can advise me whether or not this can be done as an update query in Access. Thanks. I am...
1
4666
by: Tlou5831 | last post by:
I am attempting to compare 2 tables in my DB and find unmatched criteria. There are 2 different fields in each database that need to be compared. Tbl_AppUsers Role Settings INQ ...
13
4140
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another...
4
7759
by: hapnendad | last post by:
In the question statement below Field names are in and variables are in (). All fields referenced are in what I have named the ‘PAR’ Table. Using MS Access 2003, I am working on a project...
3
2700
by: JEdwards | last post by:
Hello, I am trying to adjust the Criteria of an Update Query based on a multi-select List Box in a Form. I created a hidden text box that is populated with the results of the multi-select list...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7022
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.