Bill Benson
bensonforums at gmail.com
Fri Jun 13 14:05:25 CDT 2014
Just tested and ran this on a commandbutton click, to toggle between two sourceobjects. It stores all user changes in the subform with no problem whatsoever.
I would appreciate Tom your trying it and giving feedback.
Private Sub ModifySourceObject()
Static RecentSourceObject As String
DoCmd.Echo False
On Error GoTo Exit_Me
If RecentSourceObject = "ExampleCompany" Then
RecentSourceObject = "ExampleDriver"
Else
RecentSourceObject = "ExampleCompany"
End If
DoCmd.RunCommand acCmdSave
With Subfrm
.SourceObject = RecentSourceObject
.SetFocus
End With
DoCmd.RunCommand acCmdSubformDatasheet
Exit_Me:
DoCmd.Echo True
End Sub
From: Bill Benson [mailto:bensonforums at gmail.com]
Sent: Friday, June 13, 2014 10:48 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Saving subform format
I have also seen this simple command to work, just before changing the sourceobject. If, that is, if you are willing to let everything on the parent form be saved frequently.
DoCmd.RunCommand acCmdSave
On Jun 12, 2014 1:45 AM, "Bill Benson" <bensonforums at gmail.com <mailto:bensonforums at gmail.com> > wrote:
My bad in the verbiage (code is fine...) the problem subform is wanting to show up in Form View (Single)... even though I have set it to open in Datasheet View, making the latter the default view and setting Allow Form View = False... I am not sure how to get it forced to datasheet view, I tried
X.SetFocus
DoCmd.RunCommand acCmdSubformDatasheet
And that did not change it.
:(