Consulting

Results 1 to 5 of 5

Thread: List Box

  1. #1
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location

    List Box

    I have the following code on the click event of the List Box:

    Private Sub List_22215_Click()
    On Error GoTo Err_code
    Me.CR_NO = Left(Me.List_22215, 2) & Right("0000000" & CStr(CLng(Right(Me.List_22215, 5)) + 1), 5)
    Me.List_22215.Requery
    Me.DATE.SetFocus
    Exit Sub
    Err_code:
    MsgBox Error$


    End Sub

    When I click on any value in the list box the cursor remains on that value. I want it to go to the first value (or the top value). For that I used Me.List_22215.Requery but it doesn't work.

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Not
    Me.List_22215.Requery
    but
    Me.List_22215 = Null

  3. #3
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location
    Quote Originally Posted by OBP View Post
    Not
    Me.List_22215.Requery
    but
    Me.List_22215 = Null


    My Listbox is narrow and can show only one value. When I scroll down and click some other value Me.List_22215 = Null removes the cursor from that value but does not show the top (or first Value). I want it to go back and display the top (or first Value).

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Me.List_22215 = Me.List_22215.ItemData(0)

  5. #5
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location
    Quote Originally Posted by OBP View Post
    Me.List_22215 = Me.List_22215.ItemData(0)

    Thanks a Lot! GOD BLESS YOU!!!

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
  •