Showing a field in a form on a report if it"s checked
Showing a field in a form on a report if it"s checked
am 20.11.2007 22:13:40 von radink
Hey All,
I have a report that I would like to show a word on based on if a
field is checked in a form. For example. The form has a check box
called Fee. If that is checked, I want the word Paid to show up in the
report. If it's not checked, then I want it to not show.
Thanks for any help!
Re: Showing a field in a form on a report if it"s checked
am 20.11.2007 22:35:59 von fredg
On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> Hey All,
>
> I have a report that I would like to show a word on based on if a
> field is checked in a form. For example. The form has a check box
> called Fee. If that is checked, I want the word Paid to show up in the
> report. If it's not checked, then I want it to not show.
>
> Thanks for any help!
Is the field [Fee] included in the report's record source?
If so, then add an unbound text control to the report.
Set it's control source to:
=IIf([Fee] = True,"Paid","")
If the check box on the form is NOT included in the report's record
source, then add an unbound control to the report.
Set it's control source to:
=IIf(forms!FormName!Fee = True, "Paid","")
The form must be open when the report is run.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Re: Showing a field in a form on a report if it"s checked
am 20.11.2007 22:56:56 von radink
On Nov 20, 4:35 pm, fredg wrote:
> On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> > Hey All,
>
> > I have a report that I would like to show a word on based on if a
> > field is checked in a form. For example. The form has a check box
> > called Fee. If that is checked, I want the word Paid to show up in the
> > report. If it's not checked, then I want it to not show.
>
> > Thanks for any help!
>
> Is the field [Fee] included in the report's record source?
> If so, then add an unbound text control to the report.
> Set it's control source to:
> =IIf([Fee] = True,"Paid","")
>
> If the check box on the form is NOT included in the report's record
> source, then add an unbound control to the report.
> Set it's control source to:
> =IIf(forms!FormName!Fee = True, "Paid","")
>
> The form must be open when the report is run.
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
I did option 2, since it's not linked. It works but doesn't. If it's
set to true it doesn't show on any of them, if I set it to false it
shows it on all of them. I do have the form open when Im running it.
Thanks!
Re: Showing a field in a form on a report if it"s checked
am 20.11.2007 23:35:54 von Jana
On Nov 20, 2:56 pm, radink wrote:
> On Nov 20, 4:35 pm, fredg wrote:
>
>
>
>
>
> > On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> > > Hey All,
>
> > > I have a report that I would like to show a word on based on if a
> > > field is checked in a form. For example. The form has a check box
> > > called Fee. If that is checked, I want the word Paid to show up in the
> > > report. If it's not checked, then I want it to not show.
>
> > > Thanks for any help!
>
> > Is the field [Fee] included in the report's record source?
> > If so, then add an unbound text control to the report.
> > Set it's control source to:
> > =IIf([Fee] = True,"Paid","")
>
> > If the check box on the form is NOT included in the report's record
> > source, then add an unbound control to the report.
> > Set it's control source to:
> > =IIf(forms!FormName!Fee = True, "Paid","")
>
> > The form must be open when the report is run.
>
> > --
> > Fred
> > Please respond only to this newsgroup.
> > I do not reply to personal e-mail
>
> I did option 2, since it's not linked. It works but doesn't. If it's
> set to true it doesn't show on any of them, if I set it to false it
> shows it on all of them. I do have the form open when Im running it.
>
> Thanks!- Hide quoted text -
>
> - Show quoted text -
Since [Fee] is already True or False, omit the =True part in your IIF:
=IIf([Fee],"Paid","")
I've sometimes seen goofiness when using what evaluates to 'IF true =
true'.
HTH,
Jana
Re: Showing a field in a form on a report if it"s checked
am 20.11.2007 23:36:54 von Jana
On Nov 20, 2:56 pm, radink wrote:
> On Nov 20, 4:35 pm, fredg wrote:
>
>
>
>
>
> > On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> > > Hey All,
>
> > > I have a report that I would like to show a word on based on if a
> > > field is checked in a form. For example. The form has a check box
> > > called Fee. If that is checked, I want the word Paid to show up in the
> > > report. If it's not checked, then I want it to not show.
>
> > > Thanks for any help!
>
> > Is the field [Fee] included in the report's record source?
> > If so, then add an unbound text control to the report.
> > Set it's control source to:
> > =IIf([Fee] = True,"Paid","")
>
> > If the check box on the form is NOT included in the report's record
> > source, then add an unbound control to the report.
> > Set it's control source to:
> > =IIf(forms!FormName!Fee = True, "Paid","")
>
> > The form must be open when the report is run.
>
> > --
> > Fred
> > Please respond only to this newsgroup.
> > I do not reply to personal e-mail
>
> I did option 2, since it's not linked. It works but doesn't. If it's
> set to true it doesn't show on any of them, if I set it to false it
> shows it on all of them. I do have the form open when Im running it.
>
> Thanks!- Hide quoted text -
>
> - Show quoted text -
correction, I did option 1, not 2, but everything still applies:
=IIf(forms!FormName!Fee, "Paid","")
Jana
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 06:25:06 von Larry Linson
"radink" wrote
> I did option 2, since it's not linked. It works but
> doesn't. If it's set to true it doesn't show on any
> of them, if I set it to false it shows it on all of
> them. I do have the form open when Im running it.
Care to clarify "on any of them" and "on all of them"... any of them _whats_
and all of them _whats_ and just how is the field on the form related to
which of "them whats"?
I could guess that "them whats" are "records" displayed in the report, but
you need to confirm that, and explain how the report is supposed to
determine just which "them what" the value is supposed to apply.
Larry Linson
Microsoft Access MVP
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 15:18:36 von radink
On Nov 21, 12:25 am, "Larry Linson" wrote:
> "radink" wrote
>
> > I did option 2, since it's not linked. It works but
> > doesn't. If it's set to true it doesn't show on any
> > of them, if I set it to false it shows it on all of
> > them. I do have the form open when Im running it.
>
> Care to clarify "on any of them" and "on all of them"... any of them _whats_
> and all of them _whats_ and just how is the field on the form related to
> which of "them whats"?
>
> I could guess that "them whats" are "records" displayed in the report, but
> you need to confirm that, and explain how the report is supposed to
> determine just which "them what" the value is supposed to apply.
>
> Larry Linson
> Microsoft Access MVP
Larry,
Sorry about that. All of them means all of the records that show up in
the report. The report shows about 3 lines from each record based on
the query of the report. When I was using the code above, That Paid
would show up on all of the sections or none at all, when it should
have been only some of them.
Thanks
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 15:22:47 von radink
On Nov 20, 5:36 pm, Jana wrote:
> On Nov 20, 2:56 pm, radink wrote:
>
>
>
> > On Nov 20, 4:35 pm, fredg wrote:
>
> > > On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> > > > Hey All,
>
> > > > I have a report that I would like to show a word on based on if a
> > > > field is checked in a form. For example. The form has a check box
> > > > called Fee. If that is checked, I want the word Paid to show up in the
> > > > report. If it's not checked, then I want it to not show.
>
> > > > Thanks for any help!
>
> > > Is the field [Fee] included in the report's record source?
> > > If so, then add an unbound text control to the report.
> > > Set it's control source to:
> > > =IIf([Fee] = True,"Paid","")
>
> > > If the check box on the form is NOT included in the report's record
> > > source, then add an unbound control to the report.
> > > Set it's control source to:
> > > =IIf(forms!FormName!Fee = True, "Paid","")
>
> > > The form must be open when the report is run.
>
> > > --
> > > Fred
> > > Please respond only to this newsgroup.
> > > I do not reply to personal e-mail
>
> > I did option 2, since it's not linked. It works but doesn't. If it's
> > set to true it doesn't show on any of them, if I set it to false it
> > shows it on all of them. I do have the form open when Im running it.
>
> > Thanks!- Hide quoted text -
>
> > - Show quoted text -
>
> correction, I did option 1, not 2, but everything still applies:
> =IIf(forms!FormName!Fee, "Paid","")
>
> Jana
Jana,
These did not work either. Im using it on a text box.. should i use
seomthing else?
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 15:27:20 von radink
On Nov 20, 5:36 pm, Jana wrote:
> On Nov 20, 2:56 pm, radink wrote:
>
>
>
> > On Nov 20, 4:35 pm, fredg wrote:
>
> > > On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
> > > > Hey All,
>
> > > > I have a report that I would like to show a word on based on if a
> > > > field is checked in a form. For example. The form has a check box
> > > > called Fee. If that is checked, I want the word Paid to show up in the
> > > > report. If it's not checked, then I want it to not show.
>
> > > > Thanks for any help!
>
> > > Is the field [Fee] included in the report's record source?
> > > If so, then add an unbound text control to the report.
> > > Set it's control source to:
> > > =IIf([Fee] = True,"Paid","")
>
> > > If the check box on the form is NOT included in the report's record
> > > source, then add an unbound control to the report.
> > > Set it's control source to:
> > > =IIf(forms!FormName!Fee = True, "Paid","")
>
> > > The form must be open when the report is run.
>
> > > --
> > > Fred
> > > Please respond only to this newsgroup.
> > > I do not reply to personal e-mail
>
> > I did option 2, since it's not linked. It works but doesn't. If it's
> > set to true it doesn't show on any of them, if I set it to false it
> > shows it on all of them. I do have the form open when Im running it.
>
> > Thanks!- Hide quoted text -
>
> > - Show quoted text -
>
> correction, I did option 1, not 2, but everything still applies:
> =IIf(forms!FormName!Fee, "Paid","")
>
> Jana
I also tried something else. It seems like in the part "Paid","") it's
using nothing. If I add something in the second set of "" it puts that
in all of the records on the report. So it's not working correctly.
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 15:57:52 von arch
On Wed, 21 Nov 2007 06:22:47 -0800 (PST), radink
wrote:
>On Nov 20, 5:36 pm, Jana wrote:
>> On Nov 20, 2:56 pm, radink wrote:
>>
>>
>>
>> > On Nov 20, 4:35 pm, fredg wrote:
>>
>> > > On Tue, 20 Nov 2007 13:13:40 -0800 (PST), radink wrote:
>> > > > Hey All,
>>
>> > > > I have a report that I would like to show a word on based on if a
>> > > > field is checked in a form. For example. The form has a check box
>> > > > called Fee. If that is checked, I want the word Paid to show up in the
>> > > > report. If it's not checked, then I want it to not show.
>>
>> > > > Thanks for any help!
>>
>> > > Is the field [Fee] included in the report's record source?
>> > > If so, then add an unbound text control to the report.
>> > > Set it's control source to:
>> > > =IIf([Fee] = True,"Paid","")
>>
>> > > If the check box on the form is NOT included in the report's record
>> > > source, then add an unbound control to the report.
>> > > Set it's control source to:
>> > > =IIf(forms!FormName!Fee = True, "Paid","")
>>
>> > > The form must be open when the report is run.
>>
>> > > --
>> > > Fred
>> > > Please respond only to this newsgroup.
>> > > I do not reply to personal e-mail
>>
>> > I did option 2, since it's not linked. It works but doesn't. If it's
>> > set to true it doesn't show on any of them, if I set it to false it
>> > shows it on all of them. I do have the form open when Im running it.
>>
>> > Thanks!- Hide quoted text -
>>
>> > - Show quoted text -
>>
>> correction, I did option 1, not 2, but everything still applies:
>> =IIf(forms!FormName!Fee, "Paid","")
>>
>> Jana
>
>Jana,
>
>These did not work either. Im using it on a text box.. should i use
>seomthing else?
A text box should work just fine. You need to let the report know
which records should show as "Paid" and which ones not. The easiest
way is probably to include "Fee" as a field in the query that is the
RecordSource for the report. Then the code that several people have
supplied (Iif([Fee], "Paid", "") will work.
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 16:21:46 von u37558
Hi -
On the form that calls the report, is the check box "Fee" bound to a field in
the underlying recordset? If it's not, then what does it refer to?
Presumably each item is either paid or it isn't, so the Fee data has to be
included in the data for each record, and then made a part of the query for
the report as well.
If the Fee checkbox *is* bound to a data field, then the problem is that the
report is referring to whatever record is on the form at the time the report
is run, and that is the same one for each record the report prints.
HTH
John
radink wrote:
>> > I did option 2, since it's not linked. It works but
>> > doesn't. If it's set to true it doesn't show on any
>[quoted text clipped - 11 lines]
>> Larry Linson
>> Microsoft Access MVP
>
>Larry,
>
>Sorry about that. All of them means all of the records that show up in
>the report. The report shows about 3 lines from each record based on
>the query of the report. When I was using the code above, That Paid
>would show up on all of the sections or none at all, when it should
>have been only some of them.
>Thanks
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200711/1
Re: Showing a field in a form on a report if it"s checked
am 21.11.2007 18:29:10 von Jana
On Nov 21, 7:18 am, radink wrote:
> On Nov 21, 12:25 am, "Larry Linson" wrote:
>
>
>
>
>
> > "radink" wrote
>
> > > I did option 2, since it's not linked. It works but
> > > doesn't. If it's set to true it doesn't show on any
> > > of them, if I set it to false it shows it on all of
> > > them. I do have the form open when Im running it.
>
> > Care to clarify "on any of them" and "on all of them"... any of them _whats_
> > and all of them _whats_ and just how is the field on the form related to
> > which of "them whats"?
>
> > I could guess that "them whats" are "records" displayed in the report, but
> > you need to confirm that, and explain how the report is supposed to
> > determine just which "them what" the value is supposed to apply.
>
> > Larry Linson
> > Microsoft Access MVP
>
> Larry,
>
> Sorry about that. All of them means all of the records that show up in
> the report. The report shows about 3 lines from each record based on
> the query of the report. When I was using the code above, That Paid
> would show up on all of the sections or none at all, when it should
> have been only some of them.
> Thanks- Hide quoted text -
>
> - Show quoted text -
So, your Fee field on your form is a bound field, not an unbound
checkmark? Each record contains a Fee checkbox? If that is the case,
you need to include this in your query so it will check on each record
and make a decision of whether or not to put the word "Paid". What's
happening is your report is looking to the current record on the
form. If the record you happen to be on when you open the report has
Fee checked, then it's showing the word Paid on every record. If not,
then you get nothing for each record.
Add a calculated field to your query like this (Paste this into a
blank column in your query):
IsPaid: IIF([Fee],"Paid","")
Then add the IsPaid field to your report next to the details of each
record.
HTH,
Jana