Results 1 to 5 of 5

Thread: Printing

  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing

    Hello all: Using VBA to format a report in Access97. Putting the results of the formatting into 2 variables named str1 and str2 [img]/S/clever.gif[/img]. 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.

  2. #2
    Star Lounger
    Join Date
    Feb 2001
    Location
    South Carolina, USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing

    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

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Printing

    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.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing

    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.

  5. #5
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing

    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.

Posting Permissions

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