Doug;
I am about to wash your car for you. We are close. Like '*' works with the
below SQL however Like 'C*' does not or Like 'B*'
Like '*' it shows all records.
P.S: Should I Set the rowsource to "" before the code executes.
message
Slight correction. If the second column of the combo box is going to
return
the string
Like 'T*'
then the SQL should be
strSelected = "Select * from Products where productid " & _
Me![Combo24].Column(1)
(i.e.: you should NOT have an equal sign in there)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Try to enter product name like:
Like 'T*'
and then SQL expression as:
strSelected = "Select * from Products where productid= " &
Me![Combo24].Column(1)
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
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