When you are in the subform and click on the save button on the mainform, Access AUTOMATICALLY saves the subform record if it is dirty. So that would mean that there is NO dirty record for the save button to save. Are you thinking that it will save the mainform record or that it will save the subform record" In any case, it is way too late to perform edits for the subform record since it has already been saved.
Any error checking that needs to be done should be placed in the BeforeUpdate event of the form or subform, respectively. In this event, you can cancel the update to prevent the bad data from being saved and move focus back to the invalid field.
If blah blah Then Cancel = True MsgBox "some error message", vbOKOnly Me.somefield.SetFocus End If
And finally, get rid of the old DoMenuItem commands. The correct command for saving the current record is: DoCmd.RunCommand acCmdSaveRecord
This process has never really worked. You just hadn't previously noticed that it didn't work. "ceggy" <ceggy[ at ]discussions.microsoft.com> wrote in message news:E2C1C9B9-CAB3-4C36-8065-F74860144D28[ at ]microsoft.com...
[Quoted Text] >I have a form with a subform in it. The main form is the customer header > info and the subform is the line-items. After the user enters the > information on the subform, they click a save button on the main form. > Which > triggers the command : > > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 > > There is some error checking done and then a message box opens to give the > user the new order number. > > This all worked fine when the tables were in Access, but they are being > moved to SQL2000, and I am testing all the forms and getting the error > message > > Error 2046 SaveRecord is not available. > > If I suppress the error messages, click on the save button, click on the > subfrom and then re-click anywhere on the main form the message box with > the > new order number opens. > > Any help is greatly appricated. > > Using: > SQL2000 > Access 2003 > Lastest Version of Jet.
|