Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2002
    Posts
    12

    Unhappy Unanswered: how to set a control's default property via VBA

    I have some text fields on a form which, after the user populates, I wish to set the default property of each of the fields' to what the user entered. Any ideas?

  2. #2
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    lexloma,


    Can you be more specific!?

  3. #3
    Join Date
    Apr 2002
    Posts
    44
    well if I understand what you are asking, the Default Value is simply called DefaultValue.

    So if you give the following code for an "on change" event.

    controlname2.DefaultValue = controlname1
    controlname3.defaultValue = controlname1

    is that what you are trying to do?

  4. #4
    Join Date
    Apr 2002
    Posts
    12

    Thumbs up

    Thanks for the replies... I was working under the weight of inexperience when I posed the question: it wouldn't make sense to permanently reset the default property of a field as this would affect all users.

  5. #5
    Join Date
    Feb 2010
    Posts
    1
    Actually I want to do exactly what SilentBob suggested, but it seems whenever the form is closed and reopened the DefaultValue goes back to what I hand-set in the text box's properties. I'm using the exact code SilentBob suggested.

    Basically what I have is a continuous form with 6 unbound text boxes in the header. 6 of the (bound) fields in the detail area have their default values set as whatever is in those text boxes. The basic idea is that I want the users to be able to easily edit the default values of those 6 fields and for those settings to still be there when they come back to the form the next day.

    Any help would be appreciated!

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    For your Default Value to persist, you're going to have to store the last default values in a utilities table, before closing the form, then retrieve them when you open the form again.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

Posting Permissions

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