?
Solved

Access Forms. Save As using VBA

Posted on 2007-10-03
12
Medium Priority
?
2,506 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
0
Comment
Question by:andyb7901
  • 3
  • 2
  • 2
  • +3
12 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 20006813
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?


0
 
LVL 13

Expert Comment

by:wiswalld
ID: 20006855
I agree. Are you trying to save the data on the form?
0
 

Author Comment

by:andyb7901
ID: 20006882
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?
 
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
LVL 66

Expert Comment

by:Jim Horn
ID: 20006926
>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.
0
 
LVL 13

Expert Comment

by:wiswalld
ID: 20006957
So you are looking to save a copy of the form?

Sorry I am still confused.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 20006981
copy the template then modify the copy and save

docmd.copyobject, "newname",acform, "templateName"

 doCmd.OpenForm "newname", acDesign

'codes

 doCmd.close acForm, "newname", acsaveyes
0
 

Author Comment

by:andyb7901
ID: 20007033
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?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 20007060
'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.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20007069
did you see my post before your post?
0
 

Author Comment

by:andyb7901
ID: 20007083
Capricorn, your worked perfectly. Thanks!!
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 20007097
>I hope this makes sense?
Sadly no.  Creating forms on the fly is not something most experienced programmers would recommend.
0
 

Expert Comment

by:Henro
ID: 25666107
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
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question