Thread: Switch Function
View Single Post
  #1  
Old February 16th, 2007, 04:33 PM posted to microsoft.public.access.queries
twen
external usenet poster
 
Posts: 7
Default Switch Function

Prefix: Switch(IsNull([MrMrs]) Or [MrMrs]="",[First] & " " &
[Last],[MrMrs]=1,"Mr.",[MrMrs]=2,"Mrs.",
[MrMrs]=3,"Ms.",[MrMrs]=4,"Miss",[MrMrs]=5,"Mr. & Mrs.",[First] & " " &
[Last])

Will that work in a query if I have 1,2,3,4,5 stored as values for the
Prefix field and I want to show the values Mr. = 1, Mrs. = 2, Ms. = 3, Miss =
4, Mr. & Mrs. = 5, Else = First & " " & Last.
Should I be using a switch or an IIF function in the query. The only reason
I have this is when the user exports it to Excel I do not want numbers just
showing up I want values. Any help anyone, currently it is giving me an error
and I do not know the reason why. The value that comes up in the query is
#ERROR.
Thanks