By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,401 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,401 IT Pros & Developers. It's quick & easy.

Query is too complex

P: 1
Hi, I was trying to solve this problem since last two days but couldn't find any solution.

I wanted to execute a query which is retrieving the records from table1 by
checking the condition for a long long string .
I'm using where clause and checking the condition as-

where (citycode=B and order_no=18900) or (citycode=B and Order_no=18901). on upto (citycode=B and order_no=18950)

I'm assigning the string as follows

For i = 18900 To 18950
If i = 18900 Then
ord_string = Trim(ord_string) & "(ctCodOrd = 'B' and ord_no = " & i & ")"
ord_string = Trim(ord_string) & " or (ctCodOrd = 'B' and ord_no = " & i & ")"
End If
Next i

the query string is as follows-

sqlstr = "select * from track_det2 where " + Trim(ord_string)
Set dy = db.OpenRecordset(sqlstr, dbOpenDynaset)

After executing it is giving the error message " Query is too complex !" .

I've also tried to solve it by giving the -

db.QueryTimeout = 100 (more than 60)
To give the database enough time to execute this query but it's not worked.

Plz solve my problem.

Oct 12 '06 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,418

This is on of the limitations of Access... The number of Where conditions....

See Access specifications for more info...

Try with Between 1980 AND 1950 or with in ()

Best regards
Oct 21 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.