Simple non-VBA way to delete table contents before append?

  • Thread starter Thread starter G Lykos
  • Start date Start date
G

G Lykos

Greetings again! Is there a simple way using standard Access mechanisms to
clear existing records out of a table before appending new ones to it with a
one-step (to the user) operation? Am familiar with VBA but would prefer a
non-programming solution if available. This would seem like a very normal
sequence.

Thanks!
George
 
Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError
 
Allen, thanks for the guidance. Yes, the desire is to make the table
refresh a one-step operation for the user (i.e. goof-proof it). However,
the table has to be zapped before refresh, meaning first delete, then
append. Is there a user-visible macro mechanism that would allow specifying
a series of queries to be executed one after another?

Thanks again,
George


Allen Browne said:
Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

G Lykos said:
Greetings again! Is there a simple way using standard Access mechanisms
to
clear existing records out of a table before appending new ones to it with
a
one-step (to the user) operation? Am familiar with VBA but would prefer a
non-programming solution if available. This would seem like a very normal
sequence.

Thanks!
George
 
Also, what is the VBA syntax for simply running existing queries (vs. coding
up the equivalent operation)?

Thanks!


Allen Browne said:
Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

G Lykos said:
Greetings again! Is there a simple way using standard Access mechanisms
to
clear existing records out of a table before appending new ones to it with
a
one-step (to the user) operation? Am familiar with VBA but would prefer a
non-programming solution if available. This would seem like a very normal
sequence.

Thanks!
George
 
Looks like this is the DoCmd family.


G Lykos said:
Also, what is the VBA syntax for simply running existing queries (vs. coding
up the equivalent operation)?

Thanks!


Allen Browne said:
Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

G Lykos said:
Greetings again! Is there a simple way using standard Access mechanisms
to
clear existing records out of a table before appending new ones to it with
a
one-step (to the user) operation? Am familiar with VBA but would
prefer
 
Yes, the RunSQL works.

However, the Execute is better:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

G Lykos said:
Looks like this is the DoCmd family.


G Lykos said:
Also, what is the VBA syntax for simply running existing queries (vs. coding
up the equivalent operation)?

Thanks!


Allen Browne said:
Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError

Greetings again! Is there a simple way using standard Access mechanisms
to
clear existing records out of a table before appending new ones to it with
a
one-step (to the user) operation? Am familiar with VBA but would
prefer
a
non-programming solution if available. This would seem like a very normal
sequence.
 
Thanks!


Allen Browne said:
Yes, the RunSQL works.

However, the Execute is better:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

G Lykos said:
Looks like this is the DoCmd family.


G Lykos said:
Also, what is the VBA syntax for simply running existing queries (vs. coding
up the equivalent operation)?

Thanks!


Run a delete query.

Personally I would do that in VBA, but if you want the user to select the
right query in the querys tab and run it that would work too.

In the Click event procedure of a button, it would be:

dbEngine(0)(0).Execute "DELETE FROM [Table1];", dbFailOnError

Greetings again! Is there a simple way using standard Access mechanisms
to
clear existing records out of a table before appending new ones to it
with
a
one-step (to the user) operation? Am familiar with VBA but would prefer
a
non-programming solution if available. This would seem like a very
normal
sequence.
 

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

Back
Top