Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009

    Unanswered: Variable --> Textbox in a report


    I 'd like to do this thing.

    In a mask button code, I ask to input a string like:

    variable = inputbox(...)

    and I want the variable to be inserted automatically in the textbox of a report, the first time I open it.

    Is it possible? how?

    Thank you!

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    You can't refer to a variable directly from a form, so you'll either need to set the value in code, in the format event of the section containing the control:

    Me.ControlName = VariableName

    You can also create a public function that does nothing but return the value of the variable, and set the control source to that:


  3. #3
    Join Date
    Dec 2004
    Madison, WI
    To expand on Paul's idea, you could have a function in a module as such...

    Function retValue() as variant '(or string)
    retValue = inputbox("[Enter value:]")
    end Function

    and set the controlsource as Paul suggested:
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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