Results 1 to 4 of 4
  1. #1
    CregoryJames is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    4

    Listbox selection retains into following records.


    I have googles this and searched forum after forum, but nothing has solved my problem.

    The issue at hand is that when I make a selection in a listbox on record 1, the same item is already selected when I move to record 2.

    For example.
    For Exemptedby (my listbox) I have 5 officer names: Freeman, Markwardt, Harris, Rendon, Haynes

    If I select Markwardt in record 1, and move to record 2, Markwardt is already selected, making it look as though Markwardt was the exemptedby choice in record 2.

    I would like the listbox to default to a blank choice with each record I create or move to unless otherwise selected.

    For example.
    If I select Markwardt in record 1 for Exemptedby, when I move to record 2 I would like Exemptedby to default to a blank choice. If I move to record 3 and need to choose an Exemptedby again, say Rendon, I would like to move back to record 2 and still see the blank selection for Exemptedby.

    I have also tried linking the Exemptedby to a radio button [Exempt], where Exemptedby would not be enabled (therefore having no value) unless the [exempt] is checked. I ran into a few problems with this as well.

    A solution to either problem would be greatly appreciated. I can give any field and value data as needed to clarify. I can also provide some of the VBA scripts I have used and any screenshots if requested.

    Thank you,

    Hutchinson, Gregory SPC

  2. #2
    CregoryJames is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    4
    This was the code I tried using to enable [Exemptedby] only when [Exempt] was checked

    If Me!Exempt.Value = True Then
    Me!Exemptedby.Enabled = True
    Else
    Me!Exemptedby.Enabled = False
    End If

  3. #3
    CregoryJames is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    4
    Also tried this to set default selection to blank, as suggested by another forum

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me.Exemptedby.Value = 0
    End Sub

  4. #4
    CregoryJames is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    4
    Or if I could use comboboxes and set them to open the list on gotfocus that would work too. I have tried this script for that function

    Private Sub exemptedby_GotFocus()
    Me.exemptedby.Dropdown
    End Sub

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

Similar Threads

  1. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  2. Replies: 1
    Last Post: 08-31-2012, 01:56 PM
  3. Deleting a ListBox Selection
    By dreamnauta in forum Programming
    Replies: 4
    Last Post: 01-27-2012, 03:14 PM
  4. Cancel Selection Event for ListBox
    By is49460 in forum Forms
    Replies: 2
    Last Post: 08-04-2010, 05:53 PM
  5. Cancel listbox selection
    By vba-dev in forum Access
    Replies: 0
    Last Post: 10-26-2009, 12:18 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