Saving selected data from list box as a variable
Posted on 2014-10-18
I have successfully created a search text box to jump to a record in a list box.
Now I want to store the information from the selected record as variable data to be used in a series of form text boxes.
Here is the code I have so far:
Private Sub lstLeft_Click()
Dim strName As String
Dim strEmpID As String
Dim intItem As Integer
intItem = 0 To lstLeft.ListCount - 1
If lstLeft.Selected(intItem) Then
TempVars.Add "strName",lstLeft.Column(2, intItem) & ", " & lstLeft.Column(3, intItem)
TempVars.Add "strEmpID", lstLeft.Column(1, intItem)
The "intItem = 0 To lstLeft.ListCount - 1" is not correct.
I am only "clicking' on one record and then clicking a command button to navigate to the next form.