SQL string longer than 255 characters

T

tsison7

I have a sub that is supposed to transfer the SQL string to a query. But the
string is over 255 characters and so it cuts off the last part. How can I
transfer a string to an SQL statement from VBA that is longer than 255
characters?

Thanks,
 
R

Rick Brandt

tsison7 said:
I have a sub that is supposed to transfer the SQL string to a query. But the
string is over 255 characters and so it cuts off the last part. How can I
transfer a string to an SQL statement from VBA that is longer than 255
characters?

Post the code. Neither a VBA string variable nor a query SQL statement has a
255 character limit (more like 64000ish) so something about the way you are
doing it must be causing the problem.
 
J

John W. Vinson

I have a sub that is supposed to transfer the SQL string to a query. But the
string is over 255 characters and so it cuts off the last part. How can I
transfer a string to an SQL statement from VBA that is longer than 255
characters?

Thanks,

Are you transfering it via a Text field in a table, or via a Combo Box or
Listbox control? Those are all limited to 255 bytes; a VBA String variable or
a SQL statement is not.

John W. Vinson [MVP]
 
T

tsison7

Rick,

Something wasn't running correctly and when I checked the Locals for the
value, it only shows the first 255 characters so I thought that was the
problem. Got it fixed though.
 
S

synthkid

Rick,

Something wasn't running correctly and when I checked the Locals for the
value, it only shows the first 255 characters so I thought that was the
problem.  Got it fixed though.
--
TIA





- Show quoted text -

Rick
You said ' Something wasn't running correctly ' but can you explain
how this was fixed? I seem to have the same problem building a SQL
string. I can see only up to 255 characters and what's visible is
invalid SQL. It should be generating an error but it doesn't. From
what I read about your issue the whole string is there but I can't see
it. That's a first.

Thank you
HAS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top