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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report showing Number instead of text 2

Status
Not open for further replies.

ajhts

Technical User
May 1, 2001
84
US
Okay, I use this same method to sort by Month and it works fine. I have rug levels called Ultra High, High, Medium, and Low. To be able to sort them by this order I set it up like this.
Field is set to Number
Lookup is set to Combo Box
Value List 1,Ultra High,2,High,3,Medium,4,Low
Column Count is set at 2
Column width is 0cm;2cm.

When they enter data, they select the words, and these are on the query and the table just fine. It is when I go to print the report it is showing the number that corresponds with the text. I need the text to show up. It is working fine when I did it before. Can't figure out what I accidentally changed. Please help, I hope you can understand this!

AJ
 
I would recommend you use a small lookup table rather than the hard-coded value list. Also, I hate lookup fields since they cause confusion.
However, you can use an expression like:
=Choose([RugLevel],"Ultra High","High","Medium","Low")

When you add Ultra Low, you have to change lots of stuff while if you used a small lookup table (not lookup field) you wouldn't have to change anything other than add a record to a table.

Duane
MS Access MVP
 
i agree with dhookom. create a table with three fields: RugTypeID (Autonumber), SortOrder (number) and RugDesc (text)

then use this table as the rowsource for any combo boxes
the RugTypeID will be what goes into the table that you are entering data for.

then in your reports, bring that table into your query that the report is based on, and join the main table with the new table on field RugTypeID. bring down RugDesc into your query results and put that field on your reports.

the HUGE advantage to this is that you can add more rug types as necessary by just adding a new one to your (new) table instead of climbing thru tons of code looking for every place you referenced it.

anyhow, that's my buck-two-fitty worth..........
 
Until you make the change to the lookup table you can use the following function as the row source for your control in the report:

Switch([RugLevel]=1,"Ultra High",([RubLevel]=2,"High",([RugLevel]=3,"Medium",([RugLevel]=4,"Low")

Make sure you change the [RugLevel] to the name of your actual field in the query for the report.

Post back with questions.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Your Switch() syntax will break since there are 4 (s and only 1 ). The Choose() function is much easier to use for this instance.

Duane
MS Access MVP
 
Didn't realize that when I wrote this that I copied and pasted the ([RugLevel]= I picked up the beginning left parenthesis. Had to take that out to make it work. sorry.

Switch([RugLevel]=1,"Ultra High",[RubLevel]=2,"High",[RugLevel]=3,"Medium",[RugLevel]=4,"Low")

dhookup: You are probably correct that the Choose function s easier to setup. Choose works best when the values are numerically in perfect order starting at one. While Switch can evaluate the value independent of each pair and return a result. Now they know also how to use the Switch in this situation.







Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top