Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    17

    Question Unanswered: Setting properties of SubReport controls

    I have form that has a subform which is used to enter order details, The order can be in Euros or Currency and the user can choose this by using a check box. This automatically sets the .Format property of the "sum due " control in the sub form, to either "euros" or "currency", this works great.
    Now, I have a report to print out the order and want it to work the same, automatically setting the .format property of the "sum due" control in the subreport, but it don't work all I get is an error message saying I have an invalid reference!. Can what I am trying to do be done, or am I being dim???

    Private Sub Report_Open(Cancel As Integer)
    DoCmd.Maximize
    Forms!Generate.Visible = False
    Forms![Confirm booking].Visible = False
    If (Forms![Confirm booking]!Currency = "euros") Then
    Reports![confirm booking fax]![confirm booking fax subreport]![sum due].Format = "Euro"
    Reports![confirm booking fax]!cost.Format = "Euro"
    Else
    Reports![confirm booking fax]!cost.Format = "currency"
    Reports![confirm booking fax]![confirm booking fax subreport]![sum due].Format = "currency"
    End If
    End Sub

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    It would be interesting to see your code to set the subform as I assume you have used the same type of syntax.

    However, assuming that [confirm booking fax subreport] is the name of the subreport CONTROL and not the subreport name then I think you need something like:-

    Reports![confirm booking fax]![confirm booking fax subreport].Form.[sum due].Format = "Euro"

    If the control name is the same as the subreport name then the above is OK, but if not then [confirm booking fax subreport] should be replaced by the CONTROL name.

    In short you have to refer to the controls on the form contained in the subfor/report control (it doesn’t matter what the form’s name is as it contains only one form!).

    Hope that makes sense!


    MTB

  3. #3
    Join Date
    Sep 2004
    Posts
    17
    Hi, The code used in the form On open is :

    If Me!Currency = "euros" Then
    Forms![Confirm booking]![special stage payments input subform].Form![Sum due].Format = "Euro"
    Me!cost.Format = "Euro"
    Else
    Me!cost.Format = "currency"
    Forms![Confirm booking]![special stage payments input subform].Form![Sum due].Format = "currency"
    End If

    This sets the .fomat proprty of the [sum due] control on the [special stage payments input subform] control (which is a subform)

    I have tryied what you suggest as that was similar to wahr I thouight but I always get the same error message!!
    Any thoughts??

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi arian123

    I see that you did use the Form object in your sufform string.
    I have never acualt used a subreport, but think about it a little more, I would you should try this!

    Reports![confirm booking fax]![confirm booking fax subreport].Report.[sum due].Format = "Euro"

    I assume that it will be a report object and not a form object in the subreport control !!??


    See if that works !!

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •