Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
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?
Independent Software Vendors: 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!


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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Exchange database can often fail to mount thereby halting the work of all users connected to it. Finding out why database isn’t mounting is crucial and getting the server back online. Stellar Phoenix Mailbox Exchange Recovery is a champion product t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

572 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