Choose function in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database listing Hymn names. I have a lookup table indexed with
numbers 1-3 and names Processional, Communion, Recessional. The database
field [UseFor]is a lookup field and automatically stores the number 1-3 for
the selection.
When I try to write a report using this database, I want the field [UseFor]
to display the name Processional, Communion, Recessional.
Under the Control Source I have entered: Choose([UseFor], "Processional",
"Communion", "Recessional"). When I entered this, I show a little box next
to the field on the report in design form which says when I click on the
arrow: " Invalid Control Source and Expression must begin with "=" sign. I
have tried that, but I can't get rid of that little error box and I can't
preview the report. Any Idea what I am doing wrong? Is it because of the
Look UP Field in the database that this won't work or what?

Thanks Steve
 
This should work as long as the name of the control is not the name of a
field:
=Choose([UseFor], "Processional", "Communion", "Recessional")

I would probably create a small lookup table with three records
corresponding with the values in your UseFor. You could then add this table
to your report's record source and include the UseForDescription in your
report.
 
Thanks Duane. That did work with the = sign. The Control Name was the same
as the field name.
--
Steve


Duane Hookom said:
This should work as long as the name of the control is not the name of a
field:
=Choose([UseFor], "Processional", "Communion", "Recessional")

I would probably create a small lookup table with three records
corresponding with the values in your UseFor. You could then add this table
to your report's record source and include the UseForDescription in your
report.

--
Duane Hookom
MS Access MVP

Stevebarre said:
I have a database listing Hymn names. I have a lookup table indexed with
numbers 1-3 and names Processional, Communion, Recessional. The database
field [UseFor]is a lookup field and automatically stores the number 1-3
for
the selection.
When I try to write a report using this database, I want the field
[UseFor]
to display the name Processional, Communion, Recessional.
Under the Control Source I have entered: Choose([UseFor], "Processional",
"Communion", "Recessional"). When I entered this, I show a little box
next
to the field on the report in design form which says when I click on the
arrow: " Invalid Control Source and Expression must begin with "=" sign.
I
have tried that, but I can't get rid of that little error box and I can't
preview the report. Any Idea what I am doing wrong? Is it because of the
Look UP Field in the database that this won't work or what?

Thanks Steve
 
Back
Top