Macro "RUN SQL" exceeds limit

  • Thread starter Steve via AccessMonster.com
  • Start date
S

Steve via AccessMonster.com

I'm trying to create a macro that runs 3 action queries sequentially: An
Update, an Append, and a Delete query. Problem is, when I copy the SQL code
into a "RunSQL" macro, it exceeds the 255 char limit. I also tried
converting the SQL to VBA procedure and calling the proc via a "RunCode"
macro, but access says it can't find the procedure.

Any ideas what I could possibly be doing wrong ?
 
J

John Vinson

I'm trying to create a macro that runs 3 action queries sequentially: An
Update, an Append, and a Delete query. Problem is, when I copy the SQL code
into a "RunSQL" macro, it exceeds the 255 char limit. I also tried
converting the SQL to VBA procedure and calling the proc via a "RunCode"
macro, but access says it can't find the procedure.

Any ideas what I could possibly be doing wrong ?

Using a Macro for starters... <g>

Store the three queries and use the RunQuery method to execute the
queries, by name, rather than copying the entire SQL string into the
macro.

John W. Vinson[MVP]
 
S

Steve via AccessMonster.com

Thanks, John,
That's a good solution - how would I have the procedure run automatically ?
I'm trying to create a macro that runs 3 action queries sequentially: An
Update, an Append, and a Delete query. Problem is, when I copy the SQL code
[quoted text clipped - 3 lines]
Any ideas what I could possibly be doing wrong ?

Using a Macro for starters... <g>

Store the three queries and use the RunQuery method to execute the
queries, by name, rather than copying the entire SQL string into the
macro.

John W. Vinson[MVP]
 
J

John Vinson

Thanks, John,
That's a good solution - how would I have the procedure run automatically ?
On form open ? The form will be opened daily, and this procedure would need
to be run daily

<shrug>

Use any event which meets your needs. I have no idea what event that
might be - you do! If the Form's Open event is appropriate (and you
don't mind the queries running twice if the form should be opened
twice) by all means use it; or put a command button on a form and use
its Click event; or whatever other event works for you.

John W. Vinson[MVP]
 
S

Steve via AccessMonster.com

What is the RunQuery method ? You don't mean a DoCmd, do you ?

John said:
I'm trying to create a macro that runs 3 action queries sequentially: An
Update, an Append, and a Delete query. Problem is, when I copy the SQL code
[quoted text clipped - 3 lines]
Any ideas what I could possibly be doing wrong ?

Using a Macro for starters... <g>

Store the three queries and use the RunQuery method to execute the
queries, by name, rather than copying the entire SQL string into the
macro.

John W. Vinson[MVP]
 

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