Results 1 to 5 of 5
  1. #1
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    118

    Reset combo box to default values

    I have several combo boxes on a form. All have default values. I need code to add to a button that will reset all the boxes to their default value. I found online an tried this syntax for just one box but it did not change the box
    me.mycombobox = me.mycombobox.DefaultValue

    Any ideas would be appreciated

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    me.cboBox1 = me.cboBox1.DefaultValue
    me.cboBox2 = me.cboBox2.DefaultValue

    it DOES work.

  3. #3
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    118
    Here is the code. QtrRptFrm is the name of the combo box

    PrivateSub ClearForm_Click()
    Me.QtrRptFrm = Me.QtrRptFrm.DefaultValue
    End Sub

    The code is in the code builder of the "On Click" property of a button on the form.

    What am I doing wrong?
    Attached Thumbnails Attached Thumbnails Capture.PNG  

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    If QtrRptFrm is name of combobox then code should work. That is rather odd name for a combobox. Looks more like name of a form.

    If you want to provide db for analysis, follow instructions at bottom of my post.


    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JonathanT is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    118
    I was able to get the code to work. Apparently I did not have the code tied to the toggle button. This code also worked. Me.QtrRptFrm = "*"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 12-05-2018, 03:50 AM
  2. Replies: 3
    Last Post: 04-14-2016, 04:20 PM
  3. Reset ONE SINGLE Text Box to it's Default Value
    By mrmims in forum Programming
    Replies: 1
    Last Post: 07-18-2015, 02:47 AM
  4. Replies: 5
    Last Post: 07-07-2014, 12:00 PM
  5. Reset Combo Box to Default Value After One Hour
    By athyeh in forum Programming
    Replies: 3
    Last Post: 08-14-2013, 10:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums