T
tony Jacobs
Hello ; I am using the After update event code below, but the list is not
getting populated. What am I doing wrong. Please help. I used an identical
thing for the first combo box. It works like a charm. Wanted to limit
/filter list box based on a criteria selection Example ProductName = what
ever the list box displays. The Coulmn (0) is ProductID, column(1) is column
Name
I created a table
ProductId ProductName Desc
1 Like"C*" All Candy
2 Like "T*" All Tobaco
I want the user to select the Criteria from the drop list dispaly above. But
I can't get it to work
I even tried this for the string selection and assigned the list row source
to it after update , but still no results:
strSelected = "Select * from Products where productid= '" &
Me![Combo24].Column(1) & "'"
The first one displays perfectly when selected and the list shows only that
item, bu the second one returns a blank list. It was giving me an error of
type missmatch. but not any more.
Thanks
This is my First Attempt
+++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Combo28_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim varItem As Variant
Dim strSelected As String
' Set rs = Me.Recordset.Clone
' rs.FindFirst "[ProductName] = " & Str(Me![Combo28].Column(1))
' Me.Bookmark = rs.Bookmark
'lstInstrIssue.RowSourceType = string
' strSelected = "Select * from Products where [ProductName] = " &
Me![Combo28].Column(1)
strSelected = "Select * from Products (((where [ProductName] =
Me![Combo28].Column(1))))"
Me!lstInstrIssue.RowSource = strSelected
lstInstrIssue.Requery
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++=== First Try.
The list comes out empty it will not show records.
Here is another Try:
Private Sub Combo28_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim varItem As Variant
Dim strSelected As String
' Set rs = Me.Recordset.Clone
' rs.FindFirst "[ProductName]' =' " & Str(Me![Combo28].Column(1))
' Me.Bookmark = rs.Bookmark
'lstInstrIssue.RowSourceType = string
'strSelected = "Select * from Products where [ProductName] = " &
"Me![Combo28].Column(1)"
'strSelected = "Select * from Products where [productid] = " &
Me![Combo24].Column(0)
' strSelected = "Select * from Products (((where [ProductName] =
Me![Combo28].Column(1))))"
'strSelected = "Select * from Products ((( WHERE
((([Products].[ProductName])=[Forms]![Products]![Combo28])) )))"
'DoCmd.ApplyFilter "[ProductName] = " & "Me![Combo28].Column(1)"""
strSelected = "SELECT Products.ProductID, Products.ProductName,
Products.ProductDescription, Products.SerialNumber FROM Products WHERE
(((Products.ProductName)=[Forms]![Products]![Combo28]))"
' The above line is one long line by the way
' DoCmd.ApplyFilter "criteriaselect"
Me!lstInstrIssue.RowSource = strSelected
lstInstrIssue.Requery
End Sub
getting populated. What am I doing wrong. Please help. I used an identical
thing for the first combo box. It works like a charm. Wanted to limit
/filter list box based on a criteria selection Example ProductName = what
ever the list box displays. The Coulmn (0) is ProductID, column(1) is column
Name
I created a table
ProductId ProductName Desc
1 Like"C*" All Candy
2 Like "T*" All Tobaco
I want the user to select the Criteria from the drop list dispaly above. But
I can't get it to work
I even tried this for the string selection and assigned the list row source
to it after update , but still no results:
strSelected = "Select * from Products where productid= '" &
Me![Combo24].Column(1) & "'"
The first one displays perfectly when selected and the list shows only that
item, bu the second one returns a blank list. It was giving me an error of
type missmatch. but not any more.
Thanks
This is my First Attempt
+++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Combo28_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim varItem As Variant
Dim strSelected As String
' Set rs = Me.Recordset.Clone
' rs.FindFirst "[ProductName] = " & Str(Me![Combo28].Column(1))
' Me.Bookmark = rs.Bookmark
'lstInstrIssue.RowSourceType = string
' strSelected = "Select * from Products where [ProductName] = " &
Me![Combo28].Column(1)
strSelected = "Select * from Products (((where [ProductName] =
Me![Combo28].Column(1))))"
Me!lstInstrIssue.RowSource = strSelected
lstInstrIssue.Requery
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++=== First Try.
The list comes out empty it will not show records.
Here is another Try:
Private Sub Combo28_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Dim varItem As Variant
Dim strSelected As String
' Set rs = Me.Recordset.Clone
' rs.FindFirst "[ProductName]' =' " & Str(Me![Combo28].Column(1))
' Me.Bookmark = rs.Bookmark
'lstInstrIssue.RowSourceType = string
'strSelected = "Select * from Products where [ProductName] = " &
"Me![Combo28].Column(1)"
'strSelected = "Select * from Products where [productid] = " &
Me![Combo24].Column(0)
' strSelected = "Select * from Products (((where [ProductName] =
Me![Combo28].Column(1))))"
'strSelected = "Select * from Products ((( WHERE
((([Products].[ProductName])=[Forms]![Products]![Combo28])) )))"
'DoCmd.ApplyFilter "[ProductName] = " & "Me![Combo28].Column(1)"""
strSelected = "SELECT Products.ProductID, Products.ProductName,
Products.ProductDescription, Products.SerialNumber FROM Products WHERE
(((Products.ProductName)=[Forms]![Products]![Combo28]))"
' The above line is one long line by the way
' DoCmd.ApplyFilter "criteriaselect"
Me!lstInstrIssue.RowSource = strSelected
lstInstrIssue.Requery
End Sub