Double Click Code Help Please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been working on being able to double click a listbox that returns
records from a search and have the double click open a form with that record
on it.. i have 4 different search options using checkboxes which only one can
be selected at a time here is the code i am using but nothing happens on
double click no errors or anything, anyone tell me what is wrong with it?

Private Sub lbxResults_DblClick(Cancel As Integer)
Dim strFormName As String, strCriteria As String
Select Case inCTL.Name
Case "chkTbl1" 'Customer1
strFormName = "Cust1_Search_Results"
strCriteria = "[CustName]='" & Me!lbxResults.Column(0) & "'"
Case "chkTbl2" 'Customer2
strFormName = "Cust2_Search_Results"
strCriteria = "[Cust2Name]='" & Me!lbxResults.Column(0) & "'"
Case "chkTbl3" 'Cust3
strFormName = "Cust3_Search_Results"
strCriteria = "[Cust3Name]='" & Me!lbxResults.Column(0) & "'"
Case "chkTbl4" 'Cust4
strFormName = "Cust4_Search_Results"
strCriteria = "[Cust4Name]='" & Me!lbxResults.Column(0) & "'"
Case Else
Exit Sub
End Select

DoCmd.OpenForm strFormName, , , strCriteria
End Sub
 
Please do not post duplicate messages in multiple groups. It wastes
people's time when they are working on an issue that may be resolved in
another group.
 
Draedric said:
I have been working on being able to double click a listbox that
returns records from a search and have the double click open a form
with that record on it.. i have 4 different search options using
checkboxes which only one can be selected at a time here is the code
i am using but nothing happens on double click no errors or anything,
anyone tell me what is wrong with it?

Private Sub lbxResults_DblClick(Cancel As Integer)
Dim strFormName As String, strCriteria As String
Select Case inCTL.Name
Case "chkTbl1" 'Customer1
strFormName = "Cust1_Search_Results"
strCriteria = "[CustName]='" & Me!lbxResults.Column(0) &
"'" Case "chkTbl2" 'Customer2
strFormName = "Cust2_Search_Results"
strCriteria = "[Cust2Name]='" & Me!lbxResults.Column(0) &
"'" Case "chkTbl3" 'Cust3
strFormName = "Cust3_Search_Results"
strCriteria = "[Cust3Name]='" & Me!lbxResults.Column(0) &
"'" Case "chkTbl4" 'Cust4
strFormName = "Cust4_Search_Results"
strCriteria = "[Cust4Name]='" & Me!lbxResults.Column(0) &
"'" Case Else
Exit Sub
End Select

DoCmd.OpenForm strFormName, , , strCriteria
End Sub

What is inCTL, and what do you expect its Name property to be? It seems
very likely that you are exiting the Sub by way of the Case Else logic.
 
Back
Top