Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subreports (A2k)

    Following <post#=284911>post 284911</post#> I have created a report with 3 subreports: rptParticipants, sbrStudentClasses, sbrGuests and sbrBilling. The first 2 subforms are behaving properly but I'm having difficulty with sbrBilling. One of the fields that needs to appear on this sbr lives in tblParticipants, not qryBilling that the sbr is built on. Not sure how to go about this-I tried to drag and drop the field out of the field list to no avail.

    Please help!
    Thanks-

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    Your main report is based on tblParticipants, so why do you need a field from it in a subreport? If you really do, you should add the field to the record source of the subreport. In that case, I recommend that you make a copy of qryBilling and modify that, and use the copy as record source of the subreport. Otherwise, you might mess up the sbfBilling subform.

  3. #3
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    The field I need is curStudentPrice which is the control source for txtStudentPrice on sbfBilling and that field is on the tblParticipants. I (you!)did that to eliminate the combobox on sbfBilling that I was using to choose the student type and price.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    You might add an invisible text box bound to txtStudentPrice to the main report, and put a text box on the subreport with control source

    =[Parent]![txtStudentPrice]

    This is probably easier than modifying the record source of the subreport. On the subreport, Parent refers to the main report.

  5. #5
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    Okay, I'm gonna try that. Am I correct in using qryBilling as the record source for the sbrBilling? I assumed so as it is the record source I used for sbfBilling.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    I think it will work. As I wrote before, if you find that it needs to be modified for the subreport, make a copy and modify that instead of the original; use the copy as record source of the subreport, and keep the original as record source of the subform.

  7. #7
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    Your idea about the invisible text box worked great! Believe it or not, I've got all the parts put together and it's all behaving properly <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>
    I think my next task may take a little code to accomplish, here's the scoop: I've got separate fields for specific payment types and the individual characteristics that correspond to those types, like credit card number and check amount (among several others). When my reports print I only want the payment type they are using and their relevant characteristics. Basically I don't want blank fields next to labels. I want the label and the text box to be invisible if they are not paying by a method that corresponds to that label and text box. I think I can use the CanShrink set to yes to then scooch up the "stuff" below if necessary. I hope this makes sense!

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    CanShrink doesn't work for labels, so if a text box has a label attached to it, the label won't disappear if the text box is empty, thereby also preventing controls below it from shifting up. So in this case it may be better to use some code; you can use the On Format event of the section containing the controls to make them visible/invisible depending on some condition. If a text box is hidden, the attached label will be hidden too.

  9. #9
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    The following is the control source for txtGuestTotalOutput on sbfBilling:

    =DSum("curGuestPrice","Guests","intParticipantID=" & [intParticipantID])

    I put a text box on my sbrBilling to display the results of the above using this as the control source: =[Forms]![frmParticipants]![sbfBilling]![txtGuestTotalOutput]

    When I view the form it returns #Name-I've worked on this for hours and tried lots of different ways and now <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>

    Please help!

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    Is frmParticipants open when you view the report?

  11. #11
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    No

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    That's the cause. You can't refer to a control of a form if it isn't open - there is no value to refer to. Try setting the control source of the text box to

    =DSum("curGuestPrice","Guests","intParticipantID=" & [intParticipantID])

  13. #13
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    Well, wouldn't you know it, that's exactly what I did about 5 minutes ago. I just copied and pasted it out the existing control. I'm having a similar problem with another control now, but trying to figure it out on my own. I'll let you know if I need more help!

    Thanks

  14. #14
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subreports (A2k)

    Okay! I've got all my parts in and working. Now about the OnFormat event of the detail section of sbrBilling to control the visibility of certain controls dependant upon results of other controls. I don't even know where to begin! It seems logical to write code for each individual control of the IF/Else/Then type.

    I have a control for BillingType with the answer being either credit card or check. I only want the following controls related to the particular payment type to appear. Can you help??

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subreports (A2k)

    What are "the following controls"?

Page 1 of 2 12 LastLast

Posting Permissions

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