Hi, Hasan.
Do you have "Name AutoCorrect" turned on? If so and you change the names of
tables, fields, forms or other queries that this query uses, then this
feature could automatically alter the number of characters in the SQL
statement, particularly where a portion of the SQL statement would reside in
a cell of the Query Design Grid. I write "could automatically alter,"
because this feature doesn't always work, due to a number of bugs.
To find out more about these bugs and recommendations on how to avoid them,
you may read Allen Browne's advice and find links to relevant Microsoft
Knowledge Base articles here:
http://members.iinet.net.au/~allenbrowne/bug-03.html
Once you've run into the problem and Access gives the error that the 1024
character limit has been exceeded for a portion of the Query Design Grid,
then you can either:
1.) Use the SQL View pane to view the names of tables, queries, forms and
fields that this query uses. This is where you need to make your changes to
reduce the number of characters that won't fit into the Query Design Grid
cell. If the SQL View pane won't open after you encounter this error, then
use VBA to check the DAO library's QueryDef object's SQL property for this
particular query to extract the entire SQL statement string. You'll then
make any necessary changes to this string (you'll have to make changes in
order to prevent the same error from occurring again the next time you try
to open the query in the QBE editor), create a new query, open it in the SQL
View pane, paste this altered SQL statement into it, and then save the new
query and use it instead of your broken one.
2.) Change the names of the offending objects back to their original names
when the number of characters was within the limit. (This is usually highly
impractical, so good luck.)
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.