Log in

View Full Version : List Box



Kundan
01-20-2019, 09:37 PM
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.

OBP
01-21-2019, 02:39 AM
Not
Me.List_22215.Requery
but
Me.List_22215 = Null

Kundan
01-21-2019, 09:02 PM
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).

OBP
01-22-2019, 02:10 AM
Me.List_22215 = Me.List_22215.ItemData(0)

Kundan
01-23-2019, 09:22 PM
Me.List_22215 = Me.List_22215.ItemData(0)


Thanks a Lot! GOD BLESS YOU!!!