Results 1 to 4 of 4
  1. #1
    Dreams2Fly is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    2

    Unhappy Clear selections from a List Box?

    I've searched the archives all night and not had any luck finding what I'm looking for. So, here we go:

    I have a small form with two fields, both unbound, and a button. The first field is a list box fed by a query on one of my tables. The second is a text box to enter numerical data. The expected behavior would be for the user to select one or more items from the list box, enter a value in the text box and hit enter. Whereupon, the VB code will go through the selections and update several associated fields for each row in my table identified by they list box selections. This part works nicely so far.

    However, once the updates are done, I need the form to clear out so new data can be entered/selected without accidentally changing something due to old selections. I set VB to change the text box to null, but how do I clear the selections in the list box? I've tried requery (on both the field and the form) as well as undo but the selections are still highlighted/selected in the list box. I've also tried setting the list box to null then doing a requery and still the old selection(s) remain highlighted/selected.



    I'm sure I'm missing something amazingly simple and would sure appreciate some help in identifying it.

  2. #2
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Have you tried doing a control specific requery (opposed to a complete form requery) after you set the list box to null? Not sure if it will work, just thought I'd throw that out there to try.

  3. #3
    Dreams2Fly is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    2
    I did try the requery on the control. It didn't help.

    I think I found a rather inelegant way to clear it right after I post (of course)... I created a for-next loop that goes through all of the possible entries on the list and any that are selected TRUE, I have VB set to FALSE. Surely there's a better way than this?

    If not, I'll make a function for future use, but it just seems odd that there's no way to more simply clear out the selections.

  4. #4
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    I was going to say that I have a query driven list box on one of my forms that clears just fine with a control requery.... But I just remembered it's a combo box, not a list box.

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

Similar Threads

  1. Clear value list in combo box
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 05-27-2011, 12:45 PM
  2. projects database save listbox selections
    By taya621 in forum Access
    Replies: 33
    Last Post: 01-21-2011, 10:56 AM
  3. Clear all checkboxes?
    By thekruser in forum Forms
    Replies: 2
    Last Post: 09-16-2010, 09:50 AM
  4. Multiple drop down selections
    By Tony1955 in forum Access
    Replies: 1
    Last Post: 09-05-2010, 01:46 PM
  5. Delete multiple selections
    By Evgeny in forum Programming
    Replies: 7
    Last Post: 07-20-2010, 01:14 PM

Tags for this Thread

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 - Senior Forums