Re: VBA Recordset Query String Length Limit
- From: Jeff Banning <JeffBanning@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Jul 2007 21:44:08 -0700
When the string that is used as the SQL query is greater than 256 characters
Access gives me this error:
Run-time error '3075':
Syntax error in string in query expression 'Thing='List1' Or Thing='List2'
Or ....
I can see that the end of the query string displayed in the error message is
cut off at the 256 character location. As best as I can tell, Access cannot
handle a SQL query string that is longer than 256 characters. At least for
this particular method.
And I am afraid you will have to be a little more specific in your
suggestion because I am not understanding what you mean in your suggested fix.
Thanks for your help.
Jeff
"Alex Dybenko" wrote:
Hi,.
what means report bombs? what error do you get?
then, I think, you can use easy approach - just set resulting SQL to report
recordsource property, or to a query SQL, which is recordsource.
--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Jeff Banning" <JeffBanning@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8AAD94F5-517E-4AA9-ADD8-372471B74E32@xxxxxxxxxxxxxxxx
I have run into a problem trying to set a report recordset from a form.
Basically, you can select multiple items into a listbox which builds a
query
string:
select * from vwData where Thing='List1' or Thing='List2' or Thing='List3'
.....
I then drop that string into this bit of code to set the report recordset:
Set rstData = CurrentDb.OpenRecordset(strSQL)
DoCmd.OpenReport "rptData", acViewPreview
rstData.Close
Set rstData = Nothing
The problem is that once the SQL query string gets above 256 characters,
the
report bombs because it looks like the recordset cuts off the string at
256.
If I keep it under 256, it works as expected.
I could not find anything referencing this issue on my initial searches,
so
I am hoping someone here might be able to help me with a fix, workaround
or
whatever.
THanks,
Jeff
- Follow-Ups:
- Re: VBA Recordset Query String Length Limit
- From: Alex Dybenko
- Re: VBA Recordset Query String Length Limit
- References:
- Re: VBA Recordset Query String Length Limit
- From: Alex Dybenko
- Re: VBA Recordset Query String Length Limit
- Prev by Date: Re: Why query does this?
- Next by Date: Re: How to trap duplicate key
- Previous by thread: Re: VBA Recordset Query String Length Limit
- Next by thread: Re: VBA Recordset Query String Length Limit
- Index(es):
Relevant Pages
|