switch or IIf on a form...please help

G

Guest

I am really in a bind and cannot seem to get anything to work.
I have a form in data sheet view. It shows table info from a several fields,
one is called "department".
'department' is set values by a combo box from another form so it is either
0,1,2,3 or 4.
so when i diplay the data in another form, people do not understand 1 =
Billing and 2 = Operations. I need the form to display that.
i have tried
=IIf([department] ="0", "No
Data",IIf([department]="1","Billing",IIf([department]="2","Safety",IIf([department]="3","Operations",IIf([department]="4","Vehicle")))))

i have also tried;

= Switch([department] = "0", "NoData", [department] = "1", "Billing",
[department] = "2", "Safety", [department] = "3", "Operations", [department]
= "4", "Vehicle")

all i ever get is #Error :(
 
G

Guest

My guess is you are trying to put a text value in your departmen field which
is either a numeric field or to small to hold the text description of the
department.

It is always helpful if you post the error you are getting and where it
happens. If my above guess is correct, what you will need to do is use a
query for your form's recordsource and add a calculated field to show the the
description. If you have a department table that has the value, you could
include it in your query and use the description field. If not, the Switch
function would work well in this situation.
 

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