SQL statement too long for recordsource?

L

Lowell Moorcroft

Hello, all -

I'm trying to pass the name of an SQL statement embedded
in a form's VBA code to a report by means of a public
variable declared in the form, then accessed by the report
in the report open event which is supposed to assign the
SQL statement to the report record sources. Thus:

SQL -> form public variable -> report open event -> report
recordsource

This works fine until I add another 'where' clause to the
statement, so that there are four or five such clauses.
(I'm not where I can examine this). I then get the error
message that starts out 'Missing )] or item in the SQL
statment 'Select...', with the select statement truncated
in the error message. The record source never gets to the
report.

Does anyone know if there is a limit to the length of a
record source for a report when that source is an SQL
statement? Or, unbelievably, is there a limit to the
length of a public variable string (in the form of an SQL
statement) that can be passed from a form to a report?
Perhaps a pause should be inserted to allow a complete
reading of the string?

I've reviewed the added 'Where' clause repeatedly and it
doesn't look illegal. I suppose I could just re-do the SQL
as a query and call the query, but I rather like the SQL
clearly spelled out in code.

Thank you for any help.

Lowell Moorcroft
Oakland, CA
 
T

TC

The obvious answer, surely, is that there is a syntax error in the SQL
statement.

If you posted that statement, maybe someone could point out the error?!

TC
 

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