Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Repost: Reffering to controls in a subform/subreport

4 views
Skip to first unread message

Mattias Schlipp

unread,
Oct 4, 2001, 11:47:25 AM10/4/01
to
Hi John!

Thank you for looking in to it again.
Unfortunatly it did not help this time either.
The reffering part must be right now as it calculates
right when there is a value. There is only an error when
the subreport value is null.

The function righ now is as follows:

"Function Subtotals() As Currency
Subtotals = Nz(Reports!Köpredovisning!NettoprisSubtotal,
0) - Nz((Reports!Köpredovisning!
Köpredovisning1TjänsterSubreport.Report!
NettoprisSubtotal2), 0)

End Function"

Regards

Mattias
>-----Original Message-----
>On Wed, 3 Oct 2001 03:39:28 -0700, "Mattias Schlipp"
><info...@home.sol.se> wrote:
>
>Jumping in again, and looking more closely, it seems
you're referring
>to a control on a Subreport. You cannot do so directly;
you must go
>through the Main report, the Subreport control's Report
property, and
>then to the control. Try:
>
>>Hello Terry
>>
>>I putting this in the controls controlsource, still
>>getting invalid syntax and not being able to save it in
to
>>the control.....-
>>--
>>Mattias
>>>-----Original Message-----
>>>Try
>>>
>>>=nz([NettoprisSubtotal],0)-nz
>>((KöpredovisningTjänsterSubreport!NettoprisSubt
>>>otal2),0)
>>>
>
>nz((Reports!MainReportName!
KöpredovisningTjänsterSubreport.Report!
NettoprisSubtotal2),0)
>
> John W. Vinson[MVP]
> Come for live chats every Tuesday and Thursday
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.
>
.


M Skabialka

unread,
Oct 4, 2001, 12:57:18 PM10/4/01
to
From HELP:
If you're referring to a control on a subform or subreport, you don't have
to specify the full identifier for the form or report using the Form or
Report property. For example, you can use the following identifier to refer
to the Quantity control on the Orders Subform subform:

Forms![Orders]![Orders Subform]![Quantity]

The full identifier for the Quantity control would be:
Forms![Orders]![Orders Subform].Form![Quantity]

Also from HELP:
If the value of the variant argument is Null, the Nz function returns the
number zero or a zero-length string, depending on whether the context
indicates the value should be a number or a string.

Try changing
Nz((Reports!Köpredovisning!Köpredovisning1TjänsterSubreport.Report!Nettopris
Subtotal2), 0)

to
Nz(Reports![Köpredovisning]![Köpredovisning1TjänsterSubreport]![NettoprisSub
total2]))

HTH
Mich

Mattias Schlipp <info...@home.sol.se> wrote in message
news:577601c14ceb$dd1b6470$39ef2ecf@TKMSFTNGXA08...

Mattias Schlipp

unread,
Oct 4, 2001, 2:20:46 PM10/4/01
to
Hello!

Have tried what you suggested but still get the same error.
The function look like this now:

"Function Subtotals() As Currency
Subtotals = Nz(Reports!Köpredovisning!NettoprisSubtotal,

0) - Nz(Reports![Köpredovisning]!
[Köpredovisning1TjänsterSubreport]![NettoprisSubtotal2])
End Function"

Regards

Mattias

>..
>
>
>
>
>.
>

Dirk Goldgar

unread,
Oct 4, 2001, 4:19:20 PM10/4/01
to
Please pardon me if you've already tried this, but there's a solution that
works for forms referring to subform controls, which may be applicable with
reports and subreports. This involves wrapping the reference to the subform
(or subreport) control in the nnz() function -- the code of which is given
below:

'***************** Code Start ***************
'This code was originally written by Keri Hardwick.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Keri Hardwick
'
Function nnz(testvalue As Variant) As Variant
'Not Numeric return zero
If Not (IsNumeric(testvalue)) Then
nnz = 0
Else
nnz = testvalue
End If
End Function
'***************** Code End ****************

So, after putting the above function in a standard module, your change the
reference in your report from this:


Nz(Reports!Köpredovisning!Köpredovisning1TjänsterSubreport.Report!NettoprisS
ubtotal2, 0)

to this:

nnz(Reports!Köpredovisning!Köpredovisning1TjänsterSubreport.Report!Nettopris
Subtotal2)

--
Dirk Goldgar
www.datagnostics.com

(to reply via e-mail, remove NOSPAM from address)

"Mattias Schlipp" <info...@home.sol.se> wrote in message
news:577601c14ceb$dd1b6470$39ef2ecf@TKMSFTNGXA08...

Mattias Schlipp

unread,
Oct 5, 2001, 4:32:23 AM10/5/01
to
Hi

The nnz function made it work..finally. Thank you all
very much for the assistance.

Regards,

Mattias

>..
>
>
>
>
>.
>

Mattias Schlipp

unread,
Oct 5, 2001, 4:32:25 AM10/5/01
to
Hi

The nnz function made it work..finally. Thank you all
very much for the assistance.

Regards,

Mattias

>Nz(Reports!Köpredovisning!
Köpredovisning1TjänsterSubreport.Report!NettoprisS
>ubtotal2, 0)
>
>to this:
>
>
>
>nnz(Reports!Köpredovisning!
Köpredovisning1TjänsterSubreport.Report!Nettopris

>..
>
>
>
>
>.
>

0 new messages