473,322 Members | 1,405 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,322 software developers and data experts.

Calculated fields - I'm missing something important

I'm still a little new to Access, and I'm sure I'm missing some key
piece of information, but I can boil it all down to this:

I have an Employee table. Two of the fields are

Empl_First
Empl_Last

I have a calculated field, which is part of the record source to a
report defined as:

LNF: [Empl_Last]&", "&[Empl_First]

One of our employees is a CNA (Certified Nurse Assistant). I want to
change the LFN to include that, so I added a field Empl_Title to the
employe table, and chenged the recored source to the report:

LNF: [Empl_Last]&", "&[Empl_First]&" "&[Empl_Title]

Problem is that LNF only works for the one record that contains
something (not a null) in the Empl_Title field. What I really want is
for it to treat Empl_Title as a blank so that every record will print,
even if the employee doesn't have a title.

DO CALCULATED FIELDS ONLY WORK IF EVERY COMPONENT OF THE EXPRESSION IS
NOT A NULL?

This example probably reveals a larger misunderstanding as to how
Access works, but it's a start. Any help is greatly appreciated.

Nov 13 '05 #1
3 1442
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the the Nz() function:

LNF: [Empl_Last] & ", " & [Empl_First] & " " & Nz([Empl_Title],"")

Nz(expression1, expression2) means if expression1 is null, then use
expression2.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkHGA4echKqOuFEgEQIGZQCgih3n+UiaZdWNVQNxXT1snC I5Z0MAnAlB
vt3OdLCOwSZRHkTrAVjAGnzk
=h5mm
-----END PGP SIGNATURE-----
Mr. California wrote:

< SNIP >
One of our employees is a CNA (Certified Nurse Assistant). I want to
change the LFN to include that, so I added a field Empl_Title to the
employe table, and chenged the recored source to the report:

LNF: [Empl_Last]&", "&[Empl_First]&" "&[Empl_Title]

Problem is that LNF only works for the one record that contains
something (not a null) in the Empl_Title field. What I really want is
for it to treat Empl_Title as a blank so that every record will print,
even if the employee doesn't have a title.

DO CALCULATED FIELDS ONLY WORK IF EVERY COMPONENT OF THE EXPRESSION IS
NOT A NULL?

Nov 13 '05 #2
in sql, anything & null = null, anything + null = null, etc
so use the NZ function to change null, ie nz(empl_title, "") or
nz(amount, 0) or ...

Nov 13 '05 #3
H
the t-sql equivalent is ISNULL().

Strangely the nz() function is not always available e.g. it's in vb 6 and
VBA for access but not excel vba

It's sometimes wise to create your own function!

H
<le*********@natpro.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
in sql, anything & null = null, anything + null = null, etc
so use the NZ function to change null, ie nz(empl_title, "") or
nz(amount, 0) or ...

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SJH | last post by:
I have been given an older database and asked to make upgrades and what not. One interesting thing I have come across with the database is that it was at one time set up so one of the tables would...
3
by: Jeremy Weiss | last post by:
I've got a temp table that contains the fields: amountowed, amountpaid, and balanced. I've got a form that shows this information and I've set it up so that when the amountpaid field is changed it...
1
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
1
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates...
9
by: Mohd Al Junaibi | last post by:
Hello all, my first post here...hope it goes well. I'm currently working on stored procedure where I translated some reporting language into T-SQL The logic: I have a group of tables...
5
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
3
NatronA111
by: NatronA111 | last post by:
I am having a problem with calculated fields (...the most important one in the database!) in an MS Access query that pulls info from one table and a few other calculated fields stored in other...
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.