Borge Hansen
pcs.accessd at gmail.com
Thu Feb 19 21:47:26 CST 2009
Well, sometimes reading the Help files is the way to go. >From the ADO 2.8 API Reference - Filter Property you find that: - There is no precedence between *AND* and *OR*. Clauses can be grouped within parentheses. However, you cannot group clauses joined by an *OR*and then join the group to another clause with an *AND*, like this: (LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John' - Instead, you would construct this filter as (LastName = 'Smith' AND FirstName = 'John') OR (LastName = 'Jones' AND FirstName = 'John') So doing the filtering in two steps gets me going: rs.filter = "(Role_ID=2 OR Role_ID=3 OR Role_ID=7)" rs.filter = "(FormReport_ID=3) AND ([View]=true)" Regards, Borge On Fri, Feb 20, 2009 at 1:30 PM, Borge Hansen <pcs.accessd at gmail.com> wrote: > Thanks Stuart.... > > Another question re ADODB.recordeset > > When trying to set a filter on a recordset, I am having problems : > > rs.filter = "(FormReport_ID=3) AND (Role_ID=2 OR Role_ID=3 OR Role_ID=7) > AND ([View]=1)" > > I get the message: 3001 Arguments are of the wrong type, are out of > acceptable range, or are in conflict with one another > > The filter string - as far as I can determine - is an acceptable where > clause in an SQL query... > > So, do you have certain limitations to what you can place in a filter > statement?? > > Regards > Borge > > > > On Fri, Feb 20, 2009 at 9:40 AM, Stuart McLachlan <stuart at lexacorp.com.pg>wrote: > >> Yep >> "Set rs = rsUsers_Master" >> makes rs another reference to the same recordset. >> Close rs and you close rsUsers_Master >> >> If you want to work with a separate copy of the data use >> Set rs = rsUsers_Master.Clone >> >> -- >> Stuart >> >> >> On 20 Feb 2009 at 9:06, Borge Hansen wrote: >> >> > Hi All, >> > Quick question: >> > The application on opening of a particular Form (that stays open and >> hidden >> > until the application is closed or User logs in under another User Name) >> > opens a few ADODB recordsets. >> > On the closing of the Form the recordsets are closed and set to >> nothing... >> > >> > Example: >> > On opening of the Form, a recordset is created called rsUsers_MASTER >> > >> > >> > I am using the recordset as part of the Application's security. >> > In a separate Function called many times throughout the application >> > session, I do something like >> > >> > dim rs as new ADODB.recordset >> > set rs = rsUsers_Master >> > >> > 'Do something with the rs >> > '.. and then >> > >> > rs.close >> > set rs = nothing >> > >> > ... >> > However, that appears to make rsUsers_MASTER close and go out of >> scope.... >> > I run the sub once - it works fine - the next time I see that after >> > rs = rsUsers_MASTER >> > rs is nothing >> > >> > >> > >> > So can you people confirm that when I >> > set rs = rsUsers_MASTER >> > I am really working with rsUsers_MASTER and not a separate copy of it >> held >> > in rs ??? >> > >> > And when it comes to tidying up the rs, I don't need to do the usually >> > rs.close >> > set rs = nothing >> > >> > ?? >> > >> > I really would like to be able to work with a *separate* copy of >> > rsUsers_MASTER that I can close and set to nothing at the end of the >> > procedure. >> > >> > How do I do that?? >> > >> > Regards to all... it's been a while since I last dropped in to AccessD >> ...., >> > Borge >> > -- >> > AccessD mailing list >> > AccessD at databaseadvisors.com >> > http://databaseadvisors.com/mailman/listinfo/accessd >> > Website: http://www.databaseadvisors.com >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > >