Solved

Save Subform design changes

Posted on 2010-11-24
4
619 Views
Last Modified: 2012-05-10
How do I save a Subform design change via vba ?
Subform is Datasheet view, changes are made via vba, and I want to save these subform design changes.
The main code changes ConditionalFormatting on the subform, and it is these changes I want saved.
MS Access environemts 2003 and greater.
0
Comment
Question by:ReefIT
  • 2
4 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 34210328
In general to save form changes, DoCmd.Save acForm,"frmName"

0
 
LVL 1

Author Comment

by:ReefIT
ID: 34210728
That works for the MainForm, but it's not working for the SubForm on the MainForm as the SubForm is only a object on the MainForm
0
 
LVL 30

Accepted Solution

by:
hnasr earned 250 total points
ID: 34211018
You may let access help in saving the subform, by closing the main form:

Private Sub Command1_Click()
    DoCmd.SetWarnings False
    DoCmd.Close acForm, Forms!mainForm.Name, acSaveYes
    DoCmd.SetWarnings True
End Sub
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 34216579
IMO, you'd be much better off running the code that changes the CF each time that Form is run instead of trying to save design changes at runtime. This will decompile your database, leaving it potentially more unstable. Granted you can Compile/Compact each time, but that's very intrusive. It also means you can't deploy a .mde file (which is the preferred format).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DSum for Access 6 44
Is it possible to reset DSum? 12 41
Access Excel export not behaving 2 25
Error: Operation must use an updateable query 2 9
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now