Senin, 26 September 2011

RE: [MS_AccessPros] Report not displaying "0.00" from a null subreport

 

Clive-

He has to test HasData because if there are no rows, then the control
txtPartsTotal doesn't exist.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Clive
Sent: Monday, September 26, 2011 4:06 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Report not displaying "0.00" from a null subreport

Hi David,

Change
=Nz([frmParts-RepairOrder subreport].[Report]![txtPartsTotal])
To
=Nz([frmParts-RepairOrder subreport].[Report]![txtPartsTotal],0)
Or maybe use a text string
=Nz([frmParts-RepairOrder subreport].[Report]![txtPartsTotal],"0.00")

The value after the comma is the value returned for a zero.

Regards, Clive.

--- In MS_Access_Professionals@yahoogroups.com, "David Tolson" <drtolson@...>
wrote:
>
> Thank you John, the control source currently has this.
>
>
>
> =Nz([frmParts-RepairOrder subreport].[Report]![txtPartsTotal])
>
>
>
> Which I thought would place a zero in the field if there was no data in
> "txtPartsTotal." I changed the control source to read.
>
>
>
> =IIF(frmParts-RepairOrder subreport.Report.HasData, [frmParts-RepairOrder
> subreport].[Report]![txtPartsTotal], 0)
>
>
>
> And I am getting the following error.
>
>
>
> The expression you entered contains invalid syntax. You may have entered an
> operand without an operator.
>
>
>
> FYI, the field that is giving me the error is in the parent report and the
> subreport that has no data does not even display. I'm not sure if that makes
> a different in the way the control source is laid out.
>
>
>
> Thanks,
>
>
>
> David
>
>
>
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
> Sent: Monday, September 26, 2011 6:41 AM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: RE: [MS_AccessPros] Report not displaying "0.00" from a null
> subreport
>
>
>
>
>
> David-
>
> PMJI - put that IIF expression in the Control Source of the control where
> you're
> getting the error.
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of David
> Tolson
> Sent: Monday, September 26, 2011 12:13 PM
> To: MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> Subject: RE: [MS_AccessPros] Report not displaying "0.00" from a null
> subreport
>
> Thanks Duane, I've been out of town and didn't have access to my email, so
> I'm just getting my feet back on the ground. I have looked for the "HasData"
> property of the subreport, but haven't been able to find it, and I do not
> know where to put your suggested code. I tried placing it in the subform's
> On Load event and received a compile error.
>
> r/David
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> [mailto:MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of Duane
> Hookom
> Sent: Friday, September 23, 2011 11:55 AM
> To: Access Professionals Yahoo Group
> Subject: RE: [MS_AccessPros] Report not displaying "0.00" from a null
> subreport
>
> David,
> You can take advantage of the HasData property of the subreport. Mix this
> with IIf() to get your total or 0 like (caution "air" expression):
>
> =IIf(srptParts.Report.HasData, srptParts.Report.txtTotParts, 0)
>
> Duane Hookom
> MS Access MVP
>
>
> To: MS_Access_Professionals@yahoogroups.com
> <mailto:MS_Access_Professionals%40yahoogroups.com>
> From: drtolson@... <mailto:drtolson%40verizon.net>
> Date: Fri, 23 Sep 2011 14:00:24 +0000
> Subject: [MS_AccessPros] Report not displaying "0.00" from a null subreport
>
> Great Day, I have a report that is printing an invoice for services
> performed on a vehicle at a automobile repair shop. the report loads
> customer and vehicle data, along with totals from two subreports: one shows
> the work that was done on a vehicle - oil change, replace front brakes pads,
> etc; and the other one shows the parts that were needed for the job - oil,
> oil filter, air filter, etc. In one report no parts were used, so that
> subreport does not print, and the total fields in the parent report: "Total
> Parts", "Total Tax," and "Total Repair" all display "#Error".
>
> I suspect that these errors are the result of no data in the parts
> subreport; however, the "Total Parts", Total Tax", and "Total Repair,"
> fields all have the Nz(Field name) function, which I thought would produce
> 0.00 if that parts field was null.
>
> Thanks in advance for your assistance.
>
> r/David
>
>
>
> [Non-text portions of this message have been removed]
>
> ------------------------------------
>
> Yahoo! Groups Links
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar