Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2006

Tip: Looking for answers? Try searching our database.

Basic IF statement question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NeonSky - 29 Nov 2006 23:16 GMT
Hello All!

Hi, what I am trying to do sounds quite simple though I am not sure how to do
it. Here is the scenario: If field "A" is null and field "B" is not null then
populate field "A" with data from field "B" and then delete the contents of
field "A".

Your assistance is much appreciated!

Thank you!
Jeff Boyce - 29 Nov 2006 23:55 GMT
Does not compute!

You are taking data from field "B", putting it in "A", and deleting the data
from "A"?!

Take a look at an update query to accomplish this, and the IIF() function to
evaluate if "A" is null (?or a zero-length string?) and "B" is not.

Regards

Jeff Boyce
Microsoft Office/Access MVP

> Hello All!
>
[quoted text clipped - 9 lines]
>
> Thank you!
John Vinson - 29 Nov 2006 23:58 GMT
>Hello All!
>
>Hi, what I am trying to do sounds quite simple though I am not sure how to do
>it. Here is the scenario: If field "A" is null and field "B" is not null then
>populate field "A" with data from field "B" and then delete the contents of
>field "A".

I'm confused.

It sounds like you want to fill field A and then empty it, thereby
doing nothing at all.

I could make a guess at what you MEANT to say... but I'd rather you
say it so there's a better chance of it matching what you actually
want!

                 John W. Vinson[MVP]
NeonSky - 30 Nov 2006 00:08 GMT
You both are tottaly right, my mistake. I meant to say: If field "A" is null
and field "B" is not null then
populate field "A" with data from field "B" and then delete the contents of
field "B".

Thanks!!!

>>Hello All!
>>
[quoted text clipped - 13 lines]
>
>                  John W. Vinson[MVP]
John Vinson - 30 Nov 2006 04:41 GMT
>You both are tottaly right, my mistake. I meant to say: If field "A" is null
>and field "B" is not null then
>populate field "A" with data from field "B" and then delete the contents of
>field "B".

Update queries happen "all at once", not procedurally in sequence - so
you can simply

UPDATE MyTable
SET [A] = [B],
[B] = NULL
WHERE [A] IS NULL
AND [B] IS NOT NULL;

                 John W. Vinson[MVP]
NeonSky - 30 Nov 2006 15:17 GMT
u rock.

>>You both are tottaly right, my mistake. I meant to say: If field "A" is null
>>and field "B" is not null then
[quoted text clipped - 11 lines]
>
>                  John W. Vinson[MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.