Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2020
    Posts
    3

    Resetting a Multi Value Control on an Access Form

    I have an access form that is used for data entry. I have a clear Form button on the form that will clear all controls with the exception of the multi value control that may have upto 4 seperate names contained in the field in the record. The code I am running is:



    Code:
     Private Sub Clear_Form_Click()
    
    Me![Date] = Null
    Me![Job Number] = Null
    Me![Vehicle] = Null
    Me![Type of Work] = Null
    Me![Repair Type] = Null
    Me![Repairs] = Null
    Me![Comments] = Null
    Me![Category] = Null
    Me![SubCategory] = Null
    Me![Trip Itinerary] = Null
    Me![Work Performed By] = False
    
    
    Forms!frmDataEntry!Date.SetFocus
    End Sub
    Private Sub Clear_Form_Click()

    The error message is





    No matter what i try I cannot clear this control and when I close the form in adds a new record with just that field.

    Can you please help.

    CharlesSmith52

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    No error message displayed in your post

    Just to clarify, is this a multivalue field used in a combobox or a multiselect listbox?
    Can you post a screenshot please
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Join Date
    Nov 2020
    Posts
    3
    Quote Originally Posted by isladogs View Post
    No error message displayed in your post

    Just to clarify, is this a multivalue field used in a combobox or a multiselect listbox?
    Can you post a screenshot please
    The Error message is as follows: Run-time error 3032: Cannot perform this operation.

    The control is a Combo Box with Allow Multiple values set to YES a Row Source (names separated by semi colons and a Row Source Type of Value List.

    When you open the control it provides a list of 50 name to select from. The name(s) are selected by putting a tick in the check box next to the name or name(s).

    The field that I am have the problem with is "Work Performed By".

    Hope this helps

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I know jack about MVFs...but the name [Work Performed By] would suggest that you're dealing with a Text field. But

    Me![Work Performed By] = False

    would suggest that [Work Performed By] is a Yes/No field.

    Which is it?

    And BTW...Date is a Reserved Word, in Access VBA, and shouldn't be used as a Field name.

    Welcome to Access Forums Net!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    See if the solution shown in this thread works for you: https://www.pcreview.co.uk/threads/c...o-box.3945913/

    Me.![Work Performed By] = Array()

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Using multivalue fields (MVFs) will cause you a lot of problems and is generally considered to be a bad idea.
    I have an article explaining some of the most important issues on my website: Multivalued fields....and why you shouldn't use them
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In addition to not using reserved words as object names, you should also avoid using spaces in object names (objects include field, table, query, form and report names).

  8. #8
    Join Date
    Nov 2020
    Posts
    3
    Vlad

    Thank you for your code it works.

    Thank for you assistance to my problem.

    Charles

  9. #9
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Charles, my pleasure, glad to hear it works for you and good luck with your project.

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Resetting a form after duplicate check
    By Topflite66 in forum Forms
    Replies: 1
    Last Post: 04-10-2019, 02:10 AM
  2. Resetting form to original status on record change
    By Thompyt in forum Programming
    Replies: 8
    Last Post: 11-18-2014, 08:09 PM
  3. Multi Row Tab Control
    By Paul H in forum Forms
    Replies: 5
    Last Post: 09-07-2011, 08:14 AM
  4. Resetting Record Source on Form
    By Cheshire101 in forum Programming
    Replies: 5
    Last Post: 05-05-2011, 08:52 AM
  5. Replies: 5
    Last Post: 10-19-2010, 08:02 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