Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jul 2002
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tag property value set with VBA not saved (Access 2000)

    When I use VBA to set the value of the tag property of a text box on a form, the value appears in the properties box (sometimes) and can be subsequently referenced by the VBA program as long as the form remains open, but the tag value is not saved when I save the form. The vba code is triggered by clicking a button. When I reopen the form, tag is blank.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Silver Lounger
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,783
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag property value set with VBA not saved (Access 2000)

    The textbox you are using is likely unbound and does not have a default value. You indicate that the VBA code is triggered by clicking a button. What you could do as an alternative although I am sure there are easier ways is to write the data to a table after clicking the button. Then link the datasource to the table. Refresh the screen when complete.

    Steps are:
    1. Press Button
    2. Write data to table
    3. Refresh the screen to refresh the textbox with the data in the table.

    Since the data is written to the table, the textbox will restore the latest entry until the table is changed again.

    You can then always reference the table in VBA to use the data.

    HTH
    Gary

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

    Re: Tag property value set with VBA not saved (Access 2000)

    The tag value won't be saved unless you save the form *design*. If you switch into design view, you may see the tag value you've set, but it won't be reliable unless you save the design change. I use "permanent" tags like this, but I don't rely on trying to set and save them in code. For that purpose, I populate them from a reliable source.
    Charlotte

  5. #4
    Lounger
    Join Date
    Jul 2002
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag property value set with VBA not saved (Access 2000)

    The text box is an unbound text box with no default and the control source is a formula. Does that make a difference?

  6. #5
    Lounger
    Join Date
    Jul 2002
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag property value set with VBA not saved (Access 2000)

    After clicking the button to set the value of tag, I click the Save button on the button bar. That should be saving the design, but it doesn't save the tag value. I've had a similar problem in the past saving other properties of unbound text boxes that were programmatically changed.

Posting Permissions

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