• Printing

    • This topic has 4 replies, 4 voices, and was last updated 24 years ago.
    Author
    Topic
    #353630

    Hello all: Using VBA to format a report in Access97. Putting the results of the formatting into 2 variables named str1 and str2 . How are these variables then printed on the report. I have tried textboxes and named the control source(s) =str1 and =str2. When I run the report, inputboxes ask for str1 and str2. How can I get by this dilemma? TIA.

    Viewing 3 reply threads
    Author
    Replies
    • #517766

      Bill,

      I have used this feature in the passed to display certain error messages for a DOT program. Create an unbound textbox and change the name under OTHER heading to STR1 not the control source. In your code, you define the STR1 as whatever.

      Hope this helps!
      Deborah

    • #517840

      You can’t use variables in the control source of reports or forms because variables are only usable in code. What you can do is either as Deborah suggests, or you can populate the textbox from code based on the value of the variable. In other words, in some event procedure you set Me.Textbox1=str1, substituting the actual name of your control for Textbox1.

    • #517856

      Just define a public function in any module you want.
      It should look like this:

      Public Function fnFillTest() As String
      fnFillTest = “Nice output!”
      End Function

      Call the function in the Control Source property of the control you want the value to be displayed:
      =fnFillTest()

      That will do the job for you.

    • #517895

      Hi: Thanks for the replies. FYI. I found article Q143280 on the MS Knowledge base site that looks like what I want to accomplish. Also the Report Sample Database has the same solution.

    Viewing 3 reply threads
    Reply To: Printing

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: