473,399 Members | 3,888 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,399 software developers and data experts.

Populating Column that has some blank fields

9
Hello again! Everyone was so helpful last time, and I can feel so dumb sometimes.
Basically I am trying to create a new field with the value from field [Street Address] if it is present, if it is blank then populate it with the value from the [mailing address]. I tried an if then statement but couldn't get it to work.

[code] Address: If [Street Address] is null then [Mail Address] Else if [Street Address] not null then [Steet Address] [code]


Thanks
Mar 8 '07 #1
6 2345
Rabbit
12,516 Expert Mod 8TB
you can't use Is Null and Is Not Null in VBA, you have to use the function:
IsNull()
Mar 8 '07 #2
erajim
9
thanks Rabbit for you assistance. However, I am trying to do this in the sql view not in vb. I tried the isnull but got a syntax error. Is that because the isnull is not usable in the sql view in access? I tried it with an endif and still got the syntax error.

Expand|Select|Wrap|Line Numbers
  1.  Address: If IsNull([Street Address]) Then [Address] = [Mail Address]  Else [Address] = [Street Address]  
Any more suggestions?

Thanks
Jim
Mar 8 '07 #3
Rabbit
12,516 Expert Mod 8TB
Oh, I shoulda caught that. Then the problem is not the Is Null / Is Not Null.

SQL can't use the If Then Else Structure. You have to use the iif() function.
Expand|Select|Wrap|Line Numbers
  1. iif(Condition, Value if True, Value if False)
Mar 8 '07 #4
erajim
9
Rabbit,
That worked! It's funny after your previous post didn't work I happened to look at another post you made where someone used the IIF function. so I tried it and it worked. So you actually helped me before your last post!

I always seem to forget about the IIF function.

Thanks for you help!!!!!!!!!!!!!
Jim
Mar 8 '07 #5
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck!
Mar 8 '07 #6
NeoPa
32,556 Expert Mod 16PB
There's a better function for your particular requirement.
Nz().
You can do the whole job in one go.
Expand|Select|Wrap|Line Numbers
  1. Address: Nz([Street Address],[Mail Address])
Mar 9 '07 #7

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

Similar topics

0
by: David P. Jessup | last post by:
Background info: I'm attempting to populate an array with specific column numbers from a database. I have another array(from a linked table) that has matching column names from the original...
0
by: Jack | last post by:
Hi, I got a code that is supposed to build first column as blank and then columns corresponding to the query. However, the final result is coming with one extra column where the vendor code values...
1
by: cloverme | last post by:
Hi, I need help populating a listbox from a database on a webform. I created a an access database with a table, fields and data. Then I created a WebForm in vb.net and added a DropDownList...
3
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with...
1
by: Svelte Poshy | last post by:
Populating a field in a table depending on another In my table customers i want to populate the field segmenid depending on the choice in the lookup field Typeid. Both fields, typeid and...
3
by: EJH | last post by:
I have a Database that has three tables. One of the three is just a table that contains three fields and is filled with reference information. One field is 3-Digit(primary key), the next is...
6
by: coleenholley | last post by:
Hi All :-) I need to populate a table I created as a web form. Are there any links to show me how to do this? I CANNOT use a dtagrid for this, the table has to be laid out as follows: Header...
27
by: wideasleep | last post by:
Hello, I have a form that has a combo box that populates other fields. This works great but it doesn't save that information in the table where those fields are coming from. The only one that's...
4
by: prosad | last post by:
hello, Just solved a problem using Javascript onclick, can click on any cell in a dynamic table and it will pass the innerText object value to my form text field. parts of code given below: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.