Repost: Reffering to controls in a subform/subreport 
Author Message
 Repost: Reffering to controls in a subform/subreport

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

Quote:
>-----Original Message-----
>On Wed, 3 Oct 2001 03:39:28 -0700, "Mattias Schlipp"

>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)
Quote:

>                  John W. Vinson[MVP]    
>    Come for live chats every Tuesday and Thursday
> http://www.*-*-*.com/
>.

.


Mon, 22 Mar 2004 23:47:25 GMT  
 Repost: Reffering to controls in a subform/subreport
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


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!Nettopris
Subtotal2), 0)

End Function"

Regards

Mattias

Quote:
>-----Original Message-----
>On Wed, 3 Oct 2001 03:39:28 -0700, "Mattias Schlipp"

>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)
Quote:

>                  John W. Vinson[MVP]
>    Come for live chats every Tuesday and Thursday
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.

.


Tue, 23 Mar 2004 00:57:18 GMT  
 Repost: Reffering to controls in a subform/subreport
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

Quote:
>-----Original Message-----
>From HELP:
>If you're referring to a control on a subform or

subreport, you don't have
Quote:
>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
Quote:
>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
Quote:
>Subtotal2), 0)

>to
>Nz(Reports![K?predovisning]!

[K?predovisning1Tj?nsterSubreport]![NettoprisSub
Quote:
>total2]))

>HTH
>Mich



>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!Nettopris

- Show quoted text -

Quote:
>Subtotal2), 0)

>End Function"

>Regards

>Mattias
>>-----Original Message-----
>>On Wed, 3 Oct 2001 03:39:28 -0700, "Mattias Schlipp"

>>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
>>.

>..

>.



Tue, 23 Mar 2004 02:20:46 GMT  
 Repost: Reffering to controls in a subform/subreport
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)


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

Quote:
>-----Original Message-----
>On Wed, 3 Oct 2001 03:39:28 -0700, "Mattias Schlipp"

>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)
Quote:

>                  John W. Vinson[MVP]
>    Come for live chats every Tuesday and Thursday
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.

.


Tue, 23 Mar 2004 04:19:20 GMT  
 Repost: Reffering to controls in a subform/subreport
Hi

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

Regards,

Mattias

Quote:
>-----Original Message-----
>Please pardon me if you've already tried this, but

there's a solution that
Quote:
>works for forms referring to subform controls, which may
be applicable with
>reports and subreports.  This involves wrapping the

reference to the subform
Quote:
>(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
Quote:
>reference in your report from this:

>Nz(Reports!K?predovisning!

K?predovisning1Tj?nsterSubreport.Report!NettoprisS
Quote:
>ubtotal2, 0)

>to this:

>nnz(Reports!K?predovisning!

K?predovisning1Tj?nsterSubreport.Report!Nettopris

- Show quoted text -

Quote:
>Subtotal2)

>--
>Dirk Goldgar
>www.datagnostics.com

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



>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"

>>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
>>.

>..

>.



Tue, 23 Mar 2004 16:32:23 GMT  
 Repost: Reffering to controls in a subform/subreport
Hi

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

Regards,

Mattias

Quote:
>-----Original Message-----
>Please pardon me if you've already tried this, but

there's a solution that
Quote:
>works for forms referring to subform controls, which may
be applicable with
>reports and subreports.  This involves wrapping the

reference to the subform
Quote:
>(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
Quote:
>reference in your report from this:

>Nz(Reports!K?predovisning!

K?predovisning1Tj?nsterSubreport.Report!NettoprisS
Quote:
>ubtotal2, 0)

>to this:

>nnz(Reports!K?predovisning!

K?predovisning1Tj?nsterSubreport.Report!Nettopris

- Show quoted text -

Quote:
>Subtotal2)

>--
>Dirk Goldgar
>www.datagnostics.com

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



>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"

>>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
>>.

>..

>.



Tue, 23 Mar 2004 16:32:25 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Reffering to controls of a continuous form

2. Reffering to Control when Name is stored in Variable

3. REPOST: Filter subform to corresponding tab control

4. REPOST: Filter subform to corresponding tab control

5. REPOST: Filter subform to corresponding tab control

6. Control Subreport to Print One Data for One Subreport

7. Tabing from a control on a subform to a control on another subform

8. Default subform control to another subform control

9. REPOST: Rotate Whole SubReport

10. Repost - subreports don't work!


 
Powered by phpBB® Forum Software © phpBB Group