473,327 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to write an if statement in an update query.

Here's what I need to happen in my table: if field 4 = DP I need field 2 to equal 02 else equal 10.

Simple right?
May 10 '11 #1

✓ answered by Rabbit

The IIF function syntax is
IIf(true/false expression, true value, false value)

5 14314
Rabbit
12,516 Expert Mod 8TB
The IIF function syntax is
IIf(true/false expression, true value, false value)
May 10 '11 #2
I don't understand how to write what you are suggesting. Can you write it for me using my data?
May 10 '11 #3
Rabbit
12,516 Expert Mod 8TB
Sorry but that's not what I do. I will guide you towards the answer if you show that you're willing to put in the work to arrive at the answer. But I will not give out the answer.
May 10 '11 #4
Nevermind Rabbit, I figured it out. I used:
Expand|Select|Wrap|Line Numbers
  1. IIf("USER FIELD 4]"="DP","02","10")
Thank you for your help!!
May 10 '11 #5
NeoPa
32,556 Expert Mod 16PB
I'm afraid that doesn't work. It couldn't possibly as it always returns a FALSE result ("USER FIELD 4]" can never be equal to "DP"). Do you possibly mean :
Expand|Select|Wrap|Line Numbers
  1. IIf([USER FIELD 4]="DP","02","10")
May 11 '11 #6

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

Similar topics

3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
3
by: Megan | last post by:
hi everybody- it seems like my update query should work. the sql view seems logical. but that might be up to discussion...lol...i'm a newbie! UPDATE , Issue SET .IssueID = . WHERE ((.=.));
6
by: Greg Strong | last post by:
Hello All, In an 'Update' query can you use user-defined functions in the 'Update To' for the query? Either no or I'm missing something. See the additional info below. If I run a query...
2
by: fong.yang | last post by:
I have two tables that I need to compare. Table1 is Regions table which contains state, zipcode, city, and region number. Table2 is Shops which contains multiple fields plus state and zipcode,...
46
by: arion | last post by:
Hello, I am working on a very complex database and now I am trying to create an update query. The query is showing too few records. I am trying to update data in the table "inventory" with data...
3
by: aaronvb | last post by:
Hi there, I'm currently trying to fix up a database that has had many different people work on it and therefore is confusing me no end. Currently i am trying to update a field, in the table ...
1
by: dee | last post by:
I have a table 'LeadHistory' which has among others, the following fields. Salesman(Text) SalesmanAssmntDate(Date/Time) Disposition(Text) I also have a table 'LookUpSalesman' which has among...
2
by: jpatchak | last post by:
I want to write an update query that updates fields from one table to another. The first table (tblCopyFrom) is in a one-to-one relationship with the 2nd (tblCopyTo). The primary key in tblCopyFrom...
2
by: jrsonner | last post by:
I have multiple entries in one table that I need to update the entries in the current production table with, to revert that data back before a migration so I can migrate that data again. The...
3
by: srinit | last post by:
hi i have a table like col1 col2 col3 col4 35 R 0 0 36 W 1 35 37 R 0 0 38 W 2 35,36 I am giving...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.