Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switch Function #Error 1

Status
Not open for further replies.

MinnKota

Technical User
Nov 19, 2003
166
0
0
US
I have a report that is based on a query that gets a field from a table called "Reason." This field is a text field type.

I have a text box on my form for which the data source is [=switch([Reason]="AD", "Print Ad")] but this returns #Error and I can't figure why.
 
MinnKota
A #Error generally means an incorrect reference.

You show the data source as
[=switch([Reason]="AD", "Print Ad")]

Do you actually have the square brackets in the source, or did you just include them here for display purposes? If the square brackets are actually there, see if things work when you remove them, so the expression would be
=switch([Reason]="AD", "Print Ad")

The other possibility is that you dragged a field in and Access is getting confused because there is a difference between the Name and the Control Source. If that's the case, start with a fresh unbound text box and type your expression in the Control Source.

You could also try putting your Switch function in the query that populates the report, and then reference that column in your report.

Tom
 
I just needed to create a new text box and create the Switch Function in the control source. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top