ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,730
- Office Version
- 2007
- Platform
- Windows
I have a userform with various search options that place the results in the Listbox
Each search option works fine searching & when i click the result in the Listbox, apart from one of them.
This being the search option KEY TYPE.
I enter KW 16 in the search field & i see the 2 results in the Listbox.
When i click the value in the Listbox i then see the error message.
I debug & see this line in yellow.
Each search option works fine searching & when i click the result in the Listbox, apart from one of them.
This being the search option KEY TYPE.
I enter KW 16 in the search field & i see the 2 results in the Listbox.
When i click the value in the Listbox i then see the error message.
I debug & see this line in yellow.
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"), rw
Else
Unload DatabaseSearchForm
End If
End Sub