Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long Where Condition

Status
Not open for further replies.

Hmadyson

Programmer
Mar 14, 2001
202
US
I am trying to open a Report in code. I have a long where condition (over 450 characters). Although the help in Access 97 says that it should be accepting a where condtion with 65,000 characters it is cutting off at 255 and I am getting a message that shows me the cut off where condtion. How do I work around this? I really don't want to switch the recordsource as the report is opening up, although I can if I need to.
 
I'm really just GUESSING. You are generating the query as a string (or set of strings which you finally concatneate) and assigning the string to the sql property of a querydef object?

The Where clause string is being truncated to the nominal length of the string variable.

Hmmmmmmmmmmm,

let me count the ways.

No. I'll just suggest that you 'rebuild' the query using PARAMETERS. instantiat the query as a querydef object, assign the parameters. Opne a recordset based on the (parameterized) querydef.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
No I was sending the query as a wherecondition on the docmd.OpenReport vba command.
 
My (ver 2K) hely says the wherecondition is limited to 32K chars, which I recall as being >>>> larger than the '97 version 'allocation'.

I do not often/usually use this property. For reasons lost in the mist of foggy thinking, I have gravitated towards the approach described in my first response. I'm probably just thinking " ... everyone MUST do things the same way I do (after all, I AM brilliant, aren't I? ... ".

Hopefully someone else is a bit less egotistical, and can provide a soloution more in line with your practices.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top