Chaning Blank Query Results to different value.

G

Guest

I import data from one source(called the Financial Cube) into an Access Table
TblFinancialCube. The financial cube uses an employee code, instead of
employee name, so I link TblFinancialCube with TblEmployee, which contains
the actual name of the employee and the financial cube code.

When I run the query, I get all the records that I want. But, when an
employee is no longer with the company the query returns the field [Employee
Last Name] as blank. When I generate a report on this query, I'd like to
change the empty field to "Unknown" so that I can better group the blank
records.

Any ideas?
 
R

Rick B

Use the Nz function to replace the null value with "Unknown"...


= Nz([Employee Last Name],"Unknown")




Rick B
 
G

Guest

Thank you. I presume I was supposed to enter the expression in the criteria
of the Employee Last Name field in my query.
I did that and the query returned only the results which had an actual
employee name. The records which were blank, no longer displayed.
Did I miss something? Any ideas why that might happen?

Rick B said:
Use the Nz function to replace the null value with "Unknown"...


= Nz([Employee Last Name],"Unknown")




Rick B


Rob said:
I import data from one source(called the Financial Cube) into an Access Table
TblFinancialCube. The financial cube uses an employee code, instead of
employee name, so I link TblFinancialCube with TblEmployee, which contains
the actual name of the employee and the financial cube code.

When I run the query, I get all the records that I want. But, when an
employee is no longer with the company the query returns the field [Employee
Last Name] as blank. When I generate a report on this query, I'd like to
change the empty field to "Unknown" so that I can better group the blank
records.

Any ideas?
 
R

Rick B

No, don't enter that as a criteria. Criteria limits the returned results.

You wnat to use this in your report or form, not the query. The query
returned the records, now you need to decide how to display them in the
report or form.

Instead of pulling the [Employee Last Name] field to your report or form,
add an unbound text field. In that fiel, put the following..

= Nz([Employee Last Name],"Unknown")


This will cause the field to either display the Last Name, or "Unknown".

Rick B



Rob said:
Thank you. I presume I was supposed to enter the expression in the criteria
of the Employee Last Name field in my query.
I did that and the query returned only the results which had an actual
employee name. The records which were blank, no longer displayed.
Did I miss something? Any ideas why that might happen?

Rick B said:
Use the Nz function to replace the null value with "Unknown"...


= Nz([Employee Last Name],"Unknown")




Rick B


Rob said:
I import data from one source(called the Financial Cube) into an
Access
Table
TblFinancialCube. The financial cube uses an employee code, instead of
employee name, so I link TblFinancialCube with TblEmployee, which contains
the actual name of the employee and the financial cube code.

When I run the query, I get all the records that I want. But, when an
employee is no longer with the company the query returns the field [Employee
Last Name] as blank. When I generate a report on this query, I'd like to
change the empty field to "Unknown" so that I can better group the blank
records.

Any ideas?
 
G

Guest

As they say in the Guiness Beer commercial, "Brilliant!".
Thank you for your help. Saved me a lot of time.

Rick B said:
No, don't enter that as a criteria. Criteria limits the returned results.

You wnat to use this in your report or form, not the query. The query
returned the records, now you need to decide how to display them in the
report or form.

Instead of pulling the [Employee Last Name] field to your report or form,
add an unbound text field. In that fiel, put the following..

= Nz([Employee Last Name],"Unknown")


This will cause the field to either display the Last Name, or "Unknown".

Rick B



Rob said:
Thank you. I presume I was supposed to enter the expression in the criteria
of the Employee Last Name field in my query.
I did that and the query returned only the results which had an actual
employee name. The records which were blank, no longer displayed.
Did I miss something? Any ideas why that might happen?

Rick B said:
Use the Nz function to replace the null value with "Unknown"...


= Nz([Employee Last Name],"Unknown")




Rick B


I import data from one source(called the Financial Cube) into an Access
Table
TblFinancialCube. The financial cube uses an employee code, instead of
employee name, so I link TblFinancialCube with TblEmployee, which contains
the actual name of the employee and the financial cube code.

When I run the query, I get all the records that I want. But, when an
employee is no longer with the company the query returns the field
[Employee
Last Name] as blank. When I generate a report on this query, I'd like to
change the empty field to "Unknown" so that I can better group the blank
records.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top