Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74

    Unanswered: How to send in the text to a label control on a report on report open?

    Does anyone know how I can send in the text to a label or text control on a report on report open? (I am using the same report and the titles should be able to change).

    "labelBasedOn" is a label on my report.

    Private Sub Report_Open(Cancel As Integer)

    Me!labelBasedOn.???? = gblReportTitleText
    End Sub

  2. #2
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91

    Re: How to send in the text to a label control on a report on report open?

    Me.labelBasedOn.Caption = gblReportTitleText

  3. #3
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Thanks a lot.

    At one point "Me!txtBasedOn.Caption" bombed on me.

    For some reason when I could not see "Caption" in the pop-up comb-box after I type in "Me!txtBasedOn.", I thought that that was the reason.


    I deleted the control and recreated it and voila!

  4. #4
    Join Date
    Oct 2002
    Location
    Rochester, NY
    Posts
    84
    Originally posted by Wango
    Thanks a lot.

    At one point "Me!txtBasedOn.Caption" bombed on me.

    For some reason when I could not see "Caption" in the pop-up comb-box after I type in "Me!txtBasedOn.", I thought that that was the reason.


    I deleted the control and recreated it and voila!
    Djoko suggested using the syntax
    Me.txtBasedOn.Caption

    rather than
    Me!txtBasedOn.Caption

    When you use his syntax, the Caption property will appear in a combo box for selection.
    Regards,
    Terry

  5. #5
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Aaahaaa!!

    So, what is the difference between the "Me!someControl" and "Me.someControl"??

    And thanks for your response.

  6. #6
    Join Date
    Oct 2002
    Location
    Rochester, NY
    Posts
    84
    Originally posted by Wango
    Aaahaaa!!

    So, what is the difference between the "Me!someControl" and "Me.someControl"??

    And thanks for your response.
    The answer is pretty long winded and I'm not sure if there is a good web-site where there is documented coverage of this. This is paraphrased from a book I have written by Alison Balter called "Mastering Microsoft Access 2000 Development".`

    You should use ! (bang) when you are separating objects from it's collection as in
    Forms!frmExamples

    In most cases you can also use a period to separate an object from it's collection as in
    Me.someControl

    This works because it is really a shortcut to the default collection Controls on a form (or report). The entire reference would look something like this
    Me.Controls!someControl

    or even longer
    Forms!frmExamples.Controls!someControl

    You should always use a period to separate an object and it's properties or methods


    With all of the above said, you were doing everything correctly, because either way works. Using Me.someControl allows the popup (combo box) so you can select the property or method. I look at it that someday Microsoft is planning to get rid of the ! syntax someday.
    Regards,
    Terry

Posting Permissions

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