Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-

    I have a report with Seq control in Detail section that has Control Source set to:

    =[qrytbl_RevTran_MasterDetail_All.tbl_RevTran_Master .lngRevTranID] & "-" & [lngSeqNo]

    and it works OK.

    Now I

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    If you put a breakpoint on :
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    and hover over the different variables, are they all containing what's supposed ?
    What is mstrFormName ? an open form calling the report ? Then you should use Forms.mstrFormName.Name
    Francois

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    Hi Francois

    mstrFormName contains "frm_POS_Master" which is the report calling form.

    The

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    I'm not sure that I understand your naming:
    [qrytbl_RevTran_MasterDetail_All.tbl_RevTran_Master .lngRevTranID]
    Is that the name of a textbox on the report ?
    Or is lngRevTranID a field of the underlying query ?
    Francois

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    Seq is the text box on the report that I'm set to either :

    Me.Seq = [qrytbl_RevTran_MasterDetail_All.tbl_RevTran_Master .lngRevTranID] & "-" & [lngSeqNo]

    or

    [lngRevTranID] & "-" & [lngSeqNo]

    depending on which form opened the report

    both:

    Me.Seq = [qrytbl_RevTran_MasterDetail_All.tbl_RevTran_Master .lngRevTranID] & "-" & [lngSeqNo]

    and

    [lngRevTranID] & "-" & [lngSeqNo]

    are part of of two different underlying queries, again based on which form openrd the report.

    Thanks, John

    PS: see initial post for reference

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    if you're changing the content of a textbox in the detail on format event :
    Seq has to be an unbound control
    [qrytbl_RevTran_MasterDetail_All.tbl_RevTran_Master .lngRevTranID] has to be on the report (eventually invisible). You can't invoke a field from the underlying query if it not in the report.
    The same for lngRevTranID] and [lngSeqNo]
    Francois

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    You can change the control source of a textbox in the On Open event of the report.
    The syntax is :
    Me.TextboxName.ControlSource = "FieldName"
    FieldName has to be in the underlying query or table
    Francois

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Proper Way To Set Control Source in Code? (a2k (9.0.6926) SP-3 Jet 4.0

    Thanks Francois

    Thanks what I needed

    John

Posting Permissions

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