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

I need to do a report based on the results of two fields

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a tbl with the usual fields FirstName LastName Address etc. I have another field next to each of these which is a Yes No check box. Based on the check box determines if the field will be listed in otherwords if the address check box is checked I want that in my report of all records but in the next record if its unchecked I don't want it shown any ideas?
 
Sure thing<br>
In your report or query<br>
I create query first to get the hang of what I can expect on a report later or If I want SQL code I can cut and paste it out.<br>
I suppose you have added all of those check boxes in your table with the name address etc.<br>
If not add fields which are &quot;Yes/No&quot; instead of Number or Text<br>
so you will have <br>
Field Name Type<br>
Firstname Text<br>
FNameChecked Yes/No<br>
LastName Text<br>
LnameChecked Yes/No <br>
etc,<br>
<br>
NOW on your form you need to use these field names &quot;LnameChecked&quot; so when you click the box it wil put a TRUE statement in the table.<br>
In your query look to see if the boxes are checked or not by this:<br>
in the Criteria box of the field named &quot;FNameChecked&quot; in your query put<br>
= True<br>
or<br>
= False<br>
So in your case use the True and it will show up on your report<br>
<br>
<br>
OK<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
I think DougP is missing the point. It sounds like you want ALL the rows (so using the Criteria row in the Query designer will not work), but only wish to display some of the values. <br>
<br>
Sounds like you need to use an Immediate If (IIF) statement.<br>
<br>
Set the ControlSource of (for example) your FirstName control to =IIF(FNameChecked = True,FirstName,Null).<br>
<br>
Make sure that the NAME of the control with the formula is not the same as the field name (FirstName in my example). Use something like DisplayFirstName instead. <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
Sounds like another potential application for JimHorton's bitmapped field ... see the thread named &quot;Creating a Report of Only changed data&quot; ... ??? I'm just looking for an excuse to try this myself :)
 
First I have a database used for a club membership and we publish a members directory. However, some members want their personal information posted while others do not. Hence the need for the check box. I will use this information in a report. I owe a big thank you to all of you and especially a Mr. Killey here is what he came up with and it worked perfectly. <br>
Select the Detail Section of the Report and bring up the properties for this section select the Event On_Format add the following VB Code to it<br>
[whatever_Field_you_want}].Visible = [similiar_Checkbox]<br>
<br>
in otherwords if I have a field named city and a yes/no check box named Icludecity here is what it would look like.<br>
[City].Visible = [IncludeCity]<br>
<br>
Done!<br>
Thanks Again and I will be back great site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top