Deleting an Open Database Object

M

Michael Stevens

Hi,

Within code, I'm having a problem trying to save a new form that I've
created. (I've created the form using CreateForm however the code crashed on
the following line: DoCmd.Rename "SubFormC", acForm, strForm

I'm getting the following message...Run-time error '2007', You already have
an open database object named 'SubformC.'

This is why it is happening: Within 'FormA' I have 'SubformB' (linked) and
'SubFormC' unlinked. Using an 'On Current' event from SubformB, I'm wanting
to delete SubformC. The reason is I'm recreating SubformC and want it to
replace the old unlinked form on FormA

I realise you may be wondering why I'm doing this.......it is because I have
over one hundred tables all with different designs etc in them.

My code works fine when SubformC is already deleted. I'm wanting to know how
I can delete SubformC within the one procedure.

I would really appreciate your help here. I've spent over 10 hours on
this.....and are stuck!! If you have any ideas I'd be most grateful.

Cheers
Mike.
 
B

Bruce M. Thompson

Within code, I'm having a problem trying to save a new form that I've
created. (I've created the form using CreateForm however the code crashed on
the following line: DoCmd.Rename "SubFormC", acForm, strForm

I'm getting the following message...Run-time error '2007', You already have
an open database object named 'SubformC.'

Close "SubFormC" before attempting to delete it - in this case you need to
set the "Source Object" property for the relevant subform control to "",
then, after creating and saving the *new* "SubFormC", reset the "Source
Object" property to said subform control back to "SubFormC".
 

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