Link to home
Start Free TrialLog in
Avatar of andyb7901
andyb7901

asked on

Access Forms. Save As using VBA

Hi,
I currently have a program which saves a form. Is there anyway to save the form as and not just save?

Thanks
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Personally, I don't think I understand  what you mean by any of this, I'm afraid.

Are you saying you are creating a new form entirely using code and you then want to save it with a specific name?


I agree. Are you trying to save the data on the form?
Avatar of andyb7901
andyb7901

ASKER

I have a form which I open add changes to and then close, but before I close it I save the form. All this is done in VBA. I save the form by using

   DoCmd.Close acForm, FormName, acSaveYes

What I would like is to instead of saving the form normally I would like to save the form as. I have the following code which does this but requirees a normal save first before the form can be saved as.

 DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb().Name, acForm, "frmAnalysis", "frmTesting", False

Is there anyway to JUST save the form as, with all its contents, without havint to save it normally first. Im doing this to keep the original form as a kind of template?
 
>but before I close it I save the form.
Please explain why this is necessary.  

Saving the data entered into the form should be done automatically when the user exits the record (assuming bound form).
Also, access forms are never saved with any data, only a recordsource that is a valid table or query name.
So you are looking to save a copy of the form?

Sorry I am still confused.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Example;

I have a form named frmA. In this form I have a VBA script that takes a number a user enters, say '5'.nd The VBA script then creates 5 text fields, and inserts them on frmB. FrmA will then save these text fields to frmB.

What I would like is for frmA to insert the text fields on to frmB, but instead of saving the form normally I would like to save frmB as frmC, keeping frmB in its orignal state, and saving frmC with the newly entered text fields?

I hope this makes sense?
'I have a form which I open add changes to and then close, but before I close it I save the form'

please confirm that you are talking about changes to the form design and just data changes.
did you see my post before your post?
Capricorn, your worked perfectly. Thanks!!
>I hope this makes sense?
Sadly no.  Creating forms on the fly is not something most experienced programmers would recommend.
Why not?
I have a form that at a certain moment shows a number of  subforms.
These  subforms are identical, only their backgroundcolor and recordsource differs.

I only have one 'template' form. I copy this form for each subform I need to create.
This way I only have to adapt one form and the change prpopagates itself.

But I understand this is not wise?

Can somebody enlighten me please?


 'Always eager to learn

Henro