VBA Code Locks Up Database

G

Guest

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?)
 
G

Guest

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

Similar Threads

Sending Email using Code 4
Type Mismatch 4
Database Object 3
95 Code Won't Work In 2000 8
Where is my code wrong? 3
Error 13 - Type mismatch 8
Make table from recordset 2
Code won't run 1

Top