Tim Thiessen
tim at irwin-greenhouses.com
Wed Jun 4 17:33:40 CDT 2003
This is the code I am using to populate the textbox The listbox name is RDCSelection Dim ctlList As Control, Itm As Variant, rstRDC As Recordset, Criteria As String Set ctlList = Me!RDCSelection For Each Itm In ctlList.ItemsSelected If Len(Criteria) = 0 Then Criteria = Chr(39) & ctlList.ItemData(Itm) & Chr(39) Else Criteria = Criteria & "," & Chr(39) & ctlList.ItemData(Itm) & Chr(39) End If Next Itm Me!RDCCriteria = Criteria -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Wednesday, June 04, 2003 4:42 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Query based on multiselect listbox On 4 Jun 2003 at 16:21, Tim Thiessen wrote: > Dear Group > > I am trying to use a multselect listbox to serve as a the parameter for a > query. I'm using the IN operator but it doesn't seem to be working. I'm > using A97. Here is the SQL > > SELECT Invoice.RDC > FROM Invoice > WHERE (((Invoice.RDC) In ([Forms]![frmWrkShts]![RDCCriteria])) > AND ((Invoice.[Invoice Date])<=[Forms]![frmWrkShts]![date])); > > In the frmWrkShts, I have a text box (RDCCriteria) that is storing the items > selected from the listbox. That part is working fine. However, when I run > the query, 0 records are returned. If I run the query with the items from > the text box, I get the correct number of records. Is it not possible to > use the IN operator with a parameter query? > It is possible. What code are you using to populate your textbox? -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com