Rogue Programme
Registered User.
- Local time
- Today, 10:39
- Joined
- Jul 16, 2003
- Messages
- 55
Hi, I have two forms linked to one table. The 2 forms are linked to eachother. I have a button on form 1 that opens form 2. However, if i click to go on form 2 without saving what i've input in form 1 I lose the data.
My question - is there a way I can insert a piece of code in the buttons' on click event procedure to autosave the data in form 1 before it goes over to form 2?
Form 1 = 'frmclaimdetail'
Form 2 = 'frmpmtpack
Here's the code on the button that links the 2 forms together (on click event procedure):
Private Sub cmdopenpmtpack_Click()
On Error GoTo Err_cmdopenpmtpack_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmpmtpack"
stLinkCriteria = "[ClaimID]=" & "'" & Me![ClaimID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
[Forms]![frmpmtpack]![ClaimID].SetFocus
Exit_cmdopenpmtpack_Click:
Exit Sub
Err_cmdopenpmtpack_Click:
MsgBox Err.Description
Resume Exit_cmdopenpmtpack_Click
End Sub
Also, I'm curious as to why i lose the data if it's all being stored in the same table.
Thanks
Mike
My question - is there a way I can insert a piece of code in the buttons' on click event procedure to autosave the data in form 1 before it goes over to form 2?
Form 1 = 'frmclaimdetail'
Form 2 = 'frmpmtpack
Here's the code on the button that links the 2 forms together (on click event procedure):
Private Sub cmdopenpmtpack_Click()
On Error GoTo Err_cmdopenpmtpack_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmpmtpack"
stLinkCriteria = "[ClaimID]=" & "'" & Me![ClaimID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
[Forms]![frmpmtpack]![ClaimID].SetFocus
Exit_cmdopenpmtpack_Click:
Exit Sub
Err_cmdopenpmtpack_Click:
MsgBox Err.Description
Resume Exit_cmdopenpmtpack_Click
End Sub
Also, I'm curious as to why i lose the data if it's all being stored in the same table.
Thanks
Mike