We help IT Professionals succeed at work.

Access Forms. Save As using VBA

2,589 Views
Last Modified: 2012-06-21
Hi,
I currently have a program which saves a form. Is there anyway to save the form as and not just save?

Thanks
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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?


Commented:
I agree. Are you trying to save the data on the form?

Author

Commented:
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?
 
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
>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.

Commented:
So you are looking to save a copy of the form?

Sorry I am still confused.
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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?
CERTIFIED EXPERT

Commented:
'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.
CERTIFIED EXPERT
Top Expert 2016

Commented:
did you see my post before your post?

Author

Commented:
Capricorn, your worked perfectly. Thanks!!
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
>I hope this makes sense?
Sadly no.  Creating forms on the fly is not something most experienced programmers would recommend.

Commented:
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

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.