GPSPOW
asked on
Saving selected data from list box as a variable
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)
End If
End Sub
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.
Thanks
Glen
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
TempVars.Add "strEmpID", lstLeft.Column(1, intItem)
End If
End Sub
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.
Thanks
Glen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER