Length Of Filters 
Author Message
 Length Of Filters

Hi All

I'm hoping you can answer my problem.

Can anyone tell me how long a filter can be when using it
to open a form with the filter being the WHERE condition.

I have a series of list boxes which i use to build up a
list of criteria, only sometimes i get a error message to
say the filter is too long.  If i new how long it could be
i can prevent it from happening in the code.

docmd.openform FORMNAME,VIEW,FILTERNAME,WHERE CONDITION

thanks in advance

Gary Robinson



Mon, 01 Aug 2005 22:47:36 GMT  
 Length Of Filters
According to the help file for the OpenForm method, the WhereCondition
argument can be up to 32,768 characters.  Are you really running into
this limit?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Quote:
> Hi All

> I'm hoping you can answer my problem.

> Can anyone tell me how long a filter can be when using it
> to open a form with the filter being the WHERE condition.

> I have a series of list boxes which i use to build up a
> list of criteria, only sometimes i get a error message to
> say the filter is too long.  If i new how long it could be
> i can prevent it from happening in the code.

> docmd.openform FORMNAME,VIEW,FILTERNAME,WHERE CONDITION

> thanks in advance

> Gary Robinson



Tue, 02 Aug 2005 15:26:36 GMT  
 Length Of Filters
Limit for a complete SQL statement is 64K characters, but you cannot have
more than 99 "AND"s in a WHERE clause, or more than 255 characters in a
parameter.

One way to shorten it is to use an IN operator, i.e. instead of:
    State = "NY" OR State = "CA" OR State = "TX
use:
    State IN ("NY", "CA", "TX")

--
Allen Browne - Microsoft MVP (Most Valuable Professional)
Allen Browne's Database And Training - Perth, Western Australia.
Tips for MS Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")


Quote:
> Hi All

> I'm hoping you can answer my problem.

> Can anyone tell me how long a filter can be when using it
> to open a form with the filter being the WHERE condition.

> I have a series of list boxes which i use to build up a
> list of criteria, only sometimes i get a error message to
> say the filter is too long.  If i new how long it could be
> i can prevent it from happening in the code.

> docmd.openform FORMNAME,VIEW,FILTERNAME,WHERE CONDITION

> thanks in advance

> Gary Robinson



Wed, 03 Aug 2005 12:54:24 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem with the length of byte arrays and the length (in bytes) of diffrent datatypes

2. converting a varible length record to a fixed length rec

3. Newbie: creating a fixed-line-length file from a variable-line-length file

4. ADOX: Extending a fixed length Jet string field length

5. Filter by form - apply filter button required - Access 97

6. Applying a filter on a form filters subforms, too

7. Common Dialog filter filter's everything

8. Saving User custom filters or Exporting filtered data

9. removing a source filter from a filter collection.

10. The infamous Message Filter error - Illegal to call out while ins ide Message Filter (-2147418107)

11. Is there a maximum length for the filter property in an ADO recordset?

12. Are variable length strings faster than fixed length strings?

 

 
Powered by phpBB® Forum Software