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!

Printing Data based on Boolean Lookup

Status
Not open for further replies.

ArizonaMan

Technical User
Aug 13, 2000
9
0
0
US
I neeed some help printing text strings conatined in a lookup table based on the result of query scanning the value in a master table. The master table has fields (field1, field2, field3, etc.) which contain either True or False) for each record.

I need to produce a report that prints the text corresponding to field1, field2, field3 etc. if the value is true.

ANy suggestions on how to do this.

Thanks
 
Hi ArizonaMan

This does not make sense to me. If you have a boolean field in the master table (eg. field1, field2, etc.), how could you have "text" in this table.

Maybe I'm jumping to conclusions but if you want something like where you want the text of the detail table to appear if the master field is true: try having an onPrint detail event where you toggle the visibility of the detail text based on the true/false value of master field. Something like:

Me.txtDetail.visible=iif([booleanField]=true,true,false)

Hope this helps,
Rewdee
 
Rewdee:

Thanks. I think I understand where this is going. It sound like what I am looking for.

To clarify: I have 11 fields in the master table (ProductInterest1, ProductInterest2, etc.) These fields are populated by "True" or "False". This table also has all of the information about each contact person (Fname, Lname, Addr1, etc.)

I have another table with 3 fields; an autoindex, the field name (e.g., ProductInterest1, 2, 3, etc)and, a description of each product interest, e.g. (Chemicals and Detergents)

Each contact person has indicated an interest in some or all of the 11 product lines (thus populating the ProductInterest fields with 'true' or 'false'. I need to print out a list of each person and which product lines they are interested in.

That is what I am trying to achieve.

Thanks for your help. I will try it out.



 
If you can, things would be alot easier for you if you had three tables as:

table1->products
fields(productId,Description,etc)
table2->Contacts
fields(ContactId,Name,Address,etc.)
table3->productsContacts
fields(productId,ContactsID)

make sure you join the appropriate fields. eg. join table1.productId with table3.productId

The advantages are enormous
1. Your particular scenario of how to produce only the customers product is much much easier- just create a query with all three tables--something like:

SELECT Table2.Name, Table1.Desc
FROM Table2 INNER JOIN (Table1 INNER JOIN Table3 ON Table1.ProductID = Table3.ProductID) ON Table2.ContactID = Table3.ContactID;

2. Maintenance, to add a product or customer just create a simple (even wizard generated form) based on table1 or table2.

3. Less Code more wizards, quicker and more robust.

Hope this helps,
Rewdee
 
Rewdee:

Thanks. I think this is a much better approach.

I did work out a system using IIF statements as you suggested but I had to create 45 different IIF statements and they are now "hardwired" into the query so any change will be very hard to make.

I will try this intermediate join table system which looks like it will be much more flexible.

 
hello!!
why don't you insert criteria in the query itself, under the field you want to! by doing that you can print it in the report easily! try it! i'm not sure this can be done in the criteria but try this:
=true

Skep

"It's the man... not the machine!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top