Solved

Save Subform design changes

Posted on 2010-11-24
4
612 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

707 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

11 Experts available now in Live!

Get 1:1 Help Now