From: Mark Kubicki on 21 Apr 2010 11:34 I have 2 forms which share a common a table (frmmainMenu, and frmFixtureSchedulePrintOptions) On the first form (frmMainMenu), there is a command button that opens the second form (frmFixtureSchedulePrintOptions) -the 2nd NEVER opens otherwise (it is ALWAYS opened by the first) when the 2nd form (frmFixtureSchedulePrintOptions) is closed, focus ALWAYS returns to the first the problem is that for the one field that is common to both, if it has been changed on the first form, when I open the 2nd form, I get a write conflict error (oddly, if I change it on the second... I do not notice the conflict when closing that form and returning to the 1st The field entry on the current form should always take precedent for the field value. I thought that a work-around would be to simply save the current record and set dirty = false before I change forms, but that is not working... any suggestions would be greatly appreciated many thanks in advance, mark -------------------------------------------------------------------------------------- Private Sub cmdFixtureSchedulePrintOptions_Click() On Error GoTo Err_cmdFixtureSchedulePrintOptions_Click 'this didn't work ' With Me.Form.RecordsetClone ' .Edit ' .Update ' .Bookmark = .LastModified ' Me.Form.Bookmark = .Bookmark ' End With ' DoCmd.Close 'this didn't work ' DoCmd.RunCommand acCmdSaveRecord ' DoCmd.Close 'this didn't work ' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'this didn't work ' Dim rst As Recordset ' rst = Me.RecordsetClone ' With rst ' .Edit ' .Update ' .Bookmark = .LastModified ' Me.Form.Bookmark = .Bookmark ' End With 'this didn't work ' Me.Dirty = False 'currently, I'm trying this code, but it's not working either If Me.Dirty Then RunCommand acCmdSaveRecord End If DoCmd.Close 'this is where I open the second form stDocName = "frmFixtureSchedulePrintOptions" DoCmd.OpenForm stDocName, acNormal Exit_cmdFixtureSchedulePrintOptions: ....
From: Jeanette Cunningham on 21 Apr 2010 16:33 A couple of ideas. When you open the second form, make the first one hidden - which ever is the first one of the second one. I hope that is clear, which ever form you open first, hide it when you open the second one. After the Me.Dirty = False, requery the hidden form before opening / unhiding it. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Mark Kubicki" <Mark(a)TillotsonDesign.com> wrote in message news:OOLRXgW4KHA.5880(a)TK2MSFTNGP04.phx.gbl... >I have 2 forms which share a common a table (frmmainMenu, and >frmFixtureSchedulePrintOptions) > > On the first form (frmMainMenu), there is a command button that opens the > second form (frmFixtureSchedulePrintOptions) -the 2nd NEVER opens > otherwise (it is ALWAYS opened by the first) > when the 2nd form (frmFixtureSchedulePrintOptions) is closed, focus ALWAYS > returns to the first > > the problem is that for the one field that is common to both, if it has > been changed on the first form, when I open the 2nd form, I get a write > conflict error > (oddly, if I change it on the second... I do not notice the conflict when > closing that form and returning to the 1st > > The field entry on the current form should always take precedent for the > field value. > > I thought that a work-around would be to simply save the current record > and set dirty = false before I change forms, but that is not working... > > any suggestions would be greatly appreciated > many thanks in advance, > mark > > -------------------------------------------------------------------------------------- > > Private Sub cmdFixtureSchedulePrintOptions_Click() > On Error GoTo Err_cmdFixtureSchedulePrintOptions_Click > > 'this didn't work > ' With Me.Form.RecordsetClone > ' .Edit > ' .Update > ' .Bookmark = .LastModified > ' Me.Form.Bookmark = .Bookmark > ' End With > ' DoCmd.Close > > 'this didn't work > ' DoCmd.RunCommand acCmdSaveRecord > ' DoCmd.Close > > > 'this didn't work > ' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , > acMenuVer70 > > > 'this didn't work > ' Dim rst As Recordset > ' rst = Me.RecordsetClone > ' With rst > ' .Edit > ' .Update > ' .Bookmark = .LastModified > ' Me.Form.Bookmark = .Bookmark > ' End With > > 'this didn't work > ' Me.Dirty = False > > 'currently, I'm trying this code, but it's not working either > If Me.Dirty Then > RunCommand acCmdSaveRecord > End If > DoCmd.Close > > 'this is where I open the second form > stDocName = "frmFixtureSchedulePrintOptions" > DoCmd.OpenForm stDocName, acNormal > > Exit_cmdFixtureSchedulePrintOptions: > ... >
From: Mark Kubicki on 21 Apr 2010 20:58 thanks... got me close enough to an answer to realize that my problem is coming from "somewhere" else ....how to fix that somewhere? that will be tomorrow's challenge thnx and good night, mark "Jeanette Cunningham" <nnn(a)discussions.microsoft.com> wrote in message news:uYcAsHZ4KHA.4952(a)TK2MSFTNGP02.phx.gbl... >A couple of ideas. > When you open the second form, make the first one hidden - which ever is > the first one of the second one. > I hope that is clear, which ever form you open first, hide it when you > open the second one. > After the Me.Dirty = False, requery the hidden form before opening / > unhiding it. > > > Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia > > "Mark Kubicki" <Mark(a)TillotsonDesign.com> wrote in message > news:OOLRXgW4KHA.5880(a)TK2MSFTNGP04.phx.gbl... >>I have 2 forms which share a common a table (frmmainMenu, and >>frmFixtureSchedulePrintOptions) >> >> On the first form (frmMainMenu), there is a command button that opens >> the second form (frmFixtureSchedulePrintOptions) -the 2nd NEVER opens >> otherwise (it is ALWAYS opened by the first) >> when the 2nd form (frmFixtureSchedulePrintOptions) is closed, focus >> ALWAYS returns to the first >> >> the problem is that for the one field that is common to both, if it has >> been changed on the first form, when I open the 2nd form, I get a write >> conflict error >> (oddly, if I change it on the second... I do not notice the conflict when >> closing that form and returning to the 1st >> >> The field entry on the current form should always take precedent for the >> field value. >> >> I thought that a work-around would be to simply save the current record >> and set dirty = false before I change forms, but that is not working... >> >> any suggestions would be greatly appreciated >> many thanks in advance, >> mark >> >> -------------------------------------------------------------------------------------- >> >> Private Sub cmdFixtureSchedulePrintOptions_Click() >> On Error GoTo Err_cmdFixtureSchedulePrintOptions_Click >> >> 'this didn't work >> ' With Me.Form.RecordsetClone >> ' .Edit >> ' .Update >> ' .Bookmark = .LastModified >> ' Me.Form.Bookmark = .Bookmark >> ' End With >> ' DoCmd.Close >> >> 'this didn't work >> ' DoCmd.RunCommand acCmdSaveRecord >> ' DoCmd.Close >> >> >> 'this didn't work >> ' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , >> acMenuVer70 >> >> >> 'this didn't work >> ' Dim rst As Recordset >> ' rst = Me.RecordsetClone >> ' With rst >> ' .Edit >> ' .Update >> ' .Bookmark = .LastModified >> ' Me.Form.Bookmark = .Bookmark >> ' End With >> >> 'this didn't work >> ' Me.Dirty = False >> >> 'currently, I'm trying this code, but it's not working either >> If Me.Dirty Then >> RunCommand acCmdSaveRecord >> End If >> DoCmd.Close >> >> 'this is where I open the second form >> stDocName = "frmFixtureSchedulePrintOptions" >> DoCmd.OpenForm stDocName, acNormal >> >> Exit_cmdFixtureSchedulePrintOptions: >> ... >> > >
|
Pages: 1 Prev: Validate/Verify entry in MsgBox Next: Using the DLookup function |