Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Multiuser > Need help with ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 9 Topic 2130 of 2176
Post > Topic >>

Need help with this code to set the List Row Source

by "tony Jacobs" <tony@[EMAIL PROTECTED] > Jun 23, 2008 at 11:31 PM

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
 




 9 Posts in Topic:
Need help with this code to set the List Row Source
"tony Jacobs" &  2008-06-23 23:31:55 
Re: Need help with this code to set the List Row Source
"Alex Dybenko"   2008-06-24 07:57:00 
Re: Need help with this code to set the List Row Source
"Douglas J. Steele&q  2008-06-24 06:46:56 
Re: Need help with this code to set the List Row Source.. Almost
"tony Jacobs" &  2008-06-24 22:54:39 
Re: Need help with this code to set the List Row Source.. Almost
"Alex Dybenko"   2008-06-25 13:44:47 
Re: Need help with this code to set the List Row Source.. . It
"tony Jacobs" &  2008-06-25 23:57:21 
Re: Need help with this code to set the List Row Source.. . It
"Alex Dybenko"   2008-06-26 14:03:42 
Re: Need help with this code to set the List Row Source
"Margaret" <  2008-07-06 11:58:05 
Re: Need help with this code to set the List Row Source
strive4peace <strive4p  2008-07-06 20:04:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 4:02:10 CST 2008.