ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,731
- Office Version
- 2007
- Platform
- Windows
Hi,
Code in use is shown below.
In a userform i search for a customer.
My listbox is populated with the results.
I can select any customer in the listbox & that customers info is then shown on the screen no problem.
Having said that i have an issue where cell A5 is TOM JONES & TOM PETTY
If my search is for TOM i select TOM JONES from the listbox BUT TOM PETTY is shown on the screen.
I added 2 new rows so ANDY 1 is row A6 & ANDY 2 is row A5
I search for ANDY & select ANDY 1 inT ANDY 2 is loaded.
Do you see anything in the code that has an issue with the cell A5 value loading wrongly
Code in use is shown below.
In a userform i search for a customer.
My listbox is populated with the results.
I can select any customer in the listbox & that customers info is then shown on the screen no problem.
Having said that i have an issue where cell A5 is TOM JONES & TOM PETTY
If my search is for TOM i select TOM JONES from the listbox BUT TOM PETTY is shown on the screen.
I added 2 new rows so ANDY 1 is row A6 & ANDY 2 is row A5
I search for ANDY & select ANDY 1 inT ANDY 2 is loaded.
Do you see anything in the code that has an issue with the cell A5 value loading wrongly
Rich (BB code):
Private Sub ListBox1_Click()
Dim rw As Long
Dim ws As Worksheet
Dim answer As Integer
Set ws = ThisWorkbook.Sheets("Database")
If ListBox1.ListIndex = -1 Then Exit Sub
rw = ListBox1.List(ListBox1.ListIndex, 3)
ws.Range("A" & rw).Select
Unload Me
answer = MsgBox("OPEN CUSTOMERS FILE IN MAIN DATABASE ?", vbYesNo + vbInformation, "OPEN DATABASE MESSAGE")
If answer = vbYes Then
Database.LoadData Sheets("DATABASE"), Selection.Row
Else
Unload DatabaseSearchForm
End If
End Sub