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

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
 
A

Allen Browne

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
 
G

G Lykos

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
 
G

G Lykos

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
 
G

G Lykos

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
 
A

Allen Browne

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.
 
G

G Lykos

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.
 
Top