• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 740
  • Last Modified:

Save Subform design changes

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
ReefIT
Asked:
ReefIT
  • 2
2 Solutions
 
hnasrCommented:
In general to save form changes, DoCmd.Save acForm,"frmName"

0
 
ReefITAuthor Commented:
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
 
hnasrCommented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now