Problem with query in ADO code

G

Guest

Hi - I am running the following code:
Dim gdb As ADODB.Connection
Set gdb = New ADODB.Connection
Set gdb = CurrentProject.Connection
gdb.Execute "DELETE * from tbl_appendix_1;"
gdb.Execute "qry_app_appendix_1"

This code does empty the table but it does not populate it with any data. I
can run the exact same query by double-clicking on it and it will populate
the table - it just won't when I run it via code.

Any ideas why the code isn't working? I've used similar code before without
a problem.

Thanks!
 
K

Ken Snell [MVP]

May be a timing issue.

Try inserting
DoEvents
code step between the two query steps.


gdb.Execute "DELETE * from tbl_appendix_1;"
DoEvents
gdb.Execute "qry_app_appendix_1"
 

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

Similar Threads

ADO connection problem 9
ADO overwriting locked record problem 2
Passing ADO Recordset into a Sub procedure 1
Using ADO 2
ado recordset 5
create recordset using ADO 1
Dynamic ADO Field Names 2
Connection using ADO 5

Top