• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 932
  • Last Modified:

TADOQuery Filter Errors

Hi all,

We have a SQL database that is being accessed over vpn from many offices.  In an effort to increase speed we are trying to use the filter property instead of rerunning the sql statement for various user actions.  With simple filters it seems to work fine, but eventually errors out with 'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another'.  Is there any limit to parameters or any reason why this should be failing?  Here is an example of a filter I am using.  

((EcyToday = 1) AND ((Lookup_Name like '%dav%') OR (Acct#1 like '%dav%') OR (Acct#2 like '%dav%') OR (ARMAcct like '%dav%') OR (City like '%dav%') OR (State like '%dav%') OR (WorkPhone like '%dav%') OR (HomePhone like '%dav%') OR (CellPhone like '%dav%')))

If you run just the EcyToday = 1  OR you run just the second half, it works fine.  But it will not run with both sets of parameters.  

Any help is greatly appreciated!
0
Chipmunk77
Asked:
Chipmunk77
  • 2
  • 2
2 Solutions
 
mikelittlewoodCommented:
I don't think you can do nested OR's like that with a separate AND on the outside using filtering.
Well from the short bit of testing I've done it doesnt seem to work.
0
 
Chipmunk77Author Commented:
Hmm..  you may be right..  I don't see anything in Delphi that says it shouldn't be allowed, but it sure doesn't like it.  
Any ideas on a workaround or a way to make it accept the changes?  I cannot go back to the server as this was the original setup (and still is when the user is not remote) and the time to push the volumes of data back for a search was too long.  
0
 
Chipmunk77Author Commented:
aha!  Found the answer on a translated site...
You cannot do ((A OR B)) AND (C)     but      you are allowed to do (A AND C) OR (A AND B)
 
0
 
mikelittlewoodCommented:
Yep thought I was right Chipmunk77 :o)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now