chipsworld
Board Regular
- Joined
- May 23, 2019
- Messages
- 161
- Office Version
- 365
Hi all,
Need some help. I have done this many times before, but for some reason, when I double click on a line item in the list box, it will only return the last entry into the sheet.
I know I am missing something, but can't for the life of me, see what it is...
Any help would be greatly appreciated.
Here is the code as is...
Update...when double clicking an entry, it will work most of the time, but every 3rd or 4th time, it will return the entry selected, but with the wrong name in that field..
Need some help. I have done this many times before, but for some reason, when I double click on a line item in the list box, it will only return the last entry into the sheet.
I know I am missing something, but can't for the life of me, see what it is...
Any help would be greatly appreciated.
Here is the code as is...
VBA Code:
Private Sub lstmain_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim wsform As Worksheet
Set wsform = ThisWorkbook.Worksheets("Historical")
With wsform
If Me.lstmain.ListIndex = -1 Then 'not selected
MsgBox " Please make a selection!"
ElseIf Me.lstmain.ListIndex >= 0 Then 'User has selected
r = Me.lstmain.ListIndex
With frminput
.txtIDNum.Value = lstmain.List(r, 0)
.txtSYmp.Value = lstmain.List(r, 1)
.txtscribe.Value = lstmain.List(r, 2)
.txtoper.Value = lstmain.List(r, 3)
.txttestdat.Value = lstmain.List(r, 4)
.txttime.Value = lstmain.List(r, 5)
.txtname.Value = lstmain.List(r, 6)
.txtdob.Value = lstmain.List(r, 7)
.txtorg.Value = lstmain.List(r, 8)
.txtrole.Value = lstmain.List(r, 9)
.txtphone.Value = lstmain.List(r, 10)
.cmbresult.Value = lstmain.List(r, 11)
.cmbcontrol.Value = lstmain.List(r, 12)
.txtkitnum.Value = lstmain.List(r, 13)
.txtexpdat.Value = lstmain.List(r, 14)
End With
Unload Me
With Application
xLeft = .Left + 0.5 * .Width
xTop = .Top + 0.5 * .Height
End With
With frminput
.Left = xLeft - 0.5 * .Width
.Top = xTop - 0.5 * .Height
.Show
End With
End If
End With
End Sub
Update...when double clicking an entry, it will work most of the time, but every 3rd or 4th time, it will return the entry selected, but with the wrong name in that field..
Last edited by a moderator: