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

Critter-razy header

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I have rather interesting task.
My field consist of values
Dog
Cat
Bird
Fish
NULL
Snake
Bee

I need to get Header on my report which will look like following:
If Values="Bird" then "Bird"
If Value="Snake" or "Fish" then "Other"
If Value = "Dog" or "Cat" or "Bird" or "Snake" or "Bee" or IsNull then header should say "ALL"

Seems easy but I can't wrap my brain around it.
 
Try a SELECT...CASE stsement in the header format event that populates the caption of a label based on the data in your field.

"Teamwork means never having to take all the blame yourself."
 
I think I would be inclined to do this in a query.

SELECT IIf(Instr("Dog,Cat,Bird,Snake,Bee,All",Nz[FieldName],"All"))>0,"All",IIF ...
 
... or better yet, a table with the subsitution values.
 
... the reason? It allows additional animals to be added without having to hard code them into the database.

I'm all for upgradability if there's such a word.

Ian Mayor (UK)
Program Error
Your lack of planning is not my emergency!
 
I'm all for upgradability if there's such a word.

Scalability?

"Teamwork means never having to take all the blame yourself."
 

[machinegun] [snake]

"Teamwork means never having to take all the blame yourself."
 
No, that's the act of weighing things in a kitchen. DOH!
[smarty]

Ian Mayor (UK)
Program Error
Your lack of planning is not my emergency!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top