Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    67

    Red face Unanswered: Save values when closing listboxes and textboxes

    I have a form with two listboxes and two textboxes. I populate the listboxes and textboxes but then close them. I would like to retrieve the values that both the listboxes and textboxes had prior to closing the form. Is there a way to do that with VBA?

    Thank you for any help.

    Jim

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    When you close the form you could programmatically set the default values of the controls to be whatever is in them?
    Me.Geek = True

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    No. You have to commit the content to table data or to variables before closing the form.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I'm assuming all of these controls are unbound, otherwise the values would be retained between sessions. Default Values set in VBA in Form View (as opposed to Design View) are only good for the current session, they're lost when the form is closed. The same thing goes for variables. The only way to do this is, as suggested by Trekker, to write the content to a table, then retrieving the data in the form OnLoad event.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Feb 2004
    Posts
    67
    Thank you all. It sounds like writing to a table is the way to go.

    Thanks again.

    Jim

Posting Permissions

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