UPDATE Statement in MS Access 2003

Posted on 2005-03-01
Medium Priority
Last Modified: 2008-01-09
I have two tables, A and B on which I ran a left outer join query to get C. So C has some rows that did not match my selection criteria on ID. I need to insert a 0 into the ID column of C for all the rows that do not have an ID number.

How can I do this in Access 2003?
Question by:aashpatel
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 25

Expert Comment

ID: 13436526


Assisted Solution

AppleOng earned 80 total points
ID: 13439352

u may use this in ur select statement:

Select  A.* ,B..... ,IIF(isNull(B.id),0,B.id), ... from A left outer B.....  

My point is IIF function.


Author Comment

ID: 13439354
Where can I do this? In SQL View? Design Query?
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.


Expert Comment

ID: 13439621
You need to go into sql view to do it....

I would use the IIF statement rather than the NZ statement because it seems more straight forward to me eg:

Select IIF(Condition, [what to return if the condition is true], [what to return if the condition is false]) As [Alias Name]
LVL 25

Accepted Solution

jrb1 earned 120 total points
ID: 13440888
More straightforward than NZ?




All NZ says is:  if c.id is null, return 0, else return c.id.  Fewer function calls, so it should be faster. And that's the whole purpose of the function--to test for nulls.  IIf is great for adding logic, but seems a bit much for something this simple.

You do this in Design Query.  Go to your query and where it says "Field", enter the function.  That's all you need to do.  Or if you like to work with the SQL directly, you can add it to the SELECT statement there as well.

Author Comment

ID: 13441070
Thanks to all of you for helping me with this. I used jrb1's solution becuse it was simple to implement and is faster than IIF.

I tried to split the points up accordingly but I could only make a 30-20 split. So yhwhlivesinme, I appreciate greatly for looking into the issue and all I can give you is a bigger thank you :)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question