saving record before moving between forms

  • Thread starter Thread starter barrynichols
  • Start date Start date
B

barrynichols

morning,

i have a command on one form which opens a second form, creates a new
record with a field copied from the first form to the second.

however, when i click through without saving the first form I run into
problems. is there a line of code I can add to the below to save the
current record before actioning the command?


Private Sub Command114_Click()
On Error GoTo Err_Command114_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_Assessment"

stLinkCriteria = "[Visit ID]=" & Me![VisitID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Forms![frm_Assessment]![Shopper ID] = Me![ShopperID]

Exit_Command114_Click:
Exit Sub

Err_Command114_Click:
MsgBox Err.Description
Resume Exit_Command114_Click

End Sub

Thanks

Barry
 
Back
Top