VBA Code Locks Up Database

D

djf44

When I run this code by opening up a form it works fine. When I run the code
within a Macro it locks up the database when it is done running.

Dim dbs As Database
Dim rec1 As Recordset

Set dbs = CurrentDb

Set rec1 = dbs.OpenRecordset("NewTable")
rec1.MoveFirst

DoCmd.CopyObject , rec1!Field6, acTable, "UnCompressedPlan"

DoCmd.Close acForm, "frmRename"


End Sub
 
G

George Nicholson

when you run it via macro is frmRename open? (i.e., any chance the macro is
choking on being told to close a form that isn't open?)
 
D

djf44

The only command I put in the Macro is OpenForm. The code closes the form so
I don't think the macro is choking on that. I've tried turing warnings on an
off but so far I am stumped. I'll try opening the form in the macro and then
closing it in the macro instead of VBA. Thanks for your response.
 

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