ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Morning,
I have this working code in use.
Basically i enter a partial name in a textbox on my userform.
The listbox is then populated with names.
I make a selection in the listbox & then the userform is closed & the code above selects the row for the selected person on my worksheet.
What i have decided to do is when a selection is made in the listbox is then to show a MsgBox.
Selecting NO will close the userform & the customer is selected on my worksheet.
SO FAR ALL IS OK.
Selecting YES should close this userform & open another userform.
THIS DOESNT HAPPEN.
When YES is selected the userform closes & thats it ??
This is my code for the addition.
Currently if i double click a customers name using the code below the userform opens & that customers file is shown.
So above the code was taken from this working code but obviously ive missed something.
I have this working code in use.
VBA Code:
Private Sub ListBox1_Click()
Range("A" & ListBox1.List(ListBox1.ListIndex, 1)).Select
Unload DatabaseNameSearch
End Sub
Basically i enter a partial name in a textbox on my userform.
The listbox is then populated with names.
I make a selection in the listbox & then the userform is closed & the code above selects the row for the selected person on my worksheet.
What i have decided to do is when a selection is made in the listbox is then to show a MsgBox.
Selecting NO will close the userform & the customer is selected on my worksheet.
SO FAR ALL IS OK.
Selecting YES should close this userform & open another userform.
THIS DOESNT HAPPEN.
When YES is selected the userform closes & thats it ??
This is my code for the addition.
Code:
Private Sub ListBox1_Click()
Dim answer As Integer
Range("A" & ListBox1.List(ListBox1.ListIndex, 1)).Select
MsgBox "OPEN DATABASE ?", vbYesNo + vbCritical, "OPEN DATABASE MESSAGE"
If answer = vbYes Then
If Intersect(Range("A6", Cells(Rows.Count, "A").End(xlUp)), Target) Is Nothing Then Exit Sub
Cancel = True
Database.LoadData Me, Target.Row
Else
Unload DatabaseNameSearch
End If
End Sub
Currently if i double click a customers name using the code below the userform opens & that customers file is shown.
So above the code was taken from this working code but obviously ive missed something.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Range("A6", Cells(Rows.Count, "A").End(xlUp)), Target) Is Nothing Then Exit Sub
Cancel = True
Database.LoadData Me, Target.Row
End Sub