R
reservedbcreater
i need to change my code so that the
Private Sub Command75_Click()
event doesnt happen unles the user chose "yes"
when prompted to save record, because then they choose cancel or no to not
save the code and i need it to stay on the current form, the
Command75_click() closes the current form and opens the enxt one.
here is my current code:
Private Sub Form_Load()
Dim strNextNumber As String
strNextNumber = Nz(DMax("ID", "General Housing Survey"), 0) + 1
Me.ID = strNextNumber
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intResponse As Integer
intResponse = MsgBox("Save Record?", vbYesNoCancel)
Select Case intResponse
Case vbYes
'Do Nothing
Case vbNo
Me.Undo 'To undo the edit
Case vbCancel
Cancel = True 'To cancel the update & hence the close
End Select
End Sub
Private Sub Command75_Click()
On Error GoTo Err_Command75_Click
Dim strDocName As String
Dim strID As String
If intresponseall = yes Then
strDocName = "Water"
strID = Me.ID
DoCmd.Close
DoCmd.OpenForm strDocName
Forms(strDocName)!ID = strID
End If
Exit_Command75_Click:
Exit Sub
Err_Command75_Click:
MsgBox Err.Description
Resume Exit_Command75_Click
End Sub
Private Sub Command75_Click()
event doesnt happen unles the user chose "yes"
when prompted to save record, because then they choose cancel or no to not
save the code and i need it to stay on the current form, the
Command75_click() closes the current form and opens the enxt one.
here is my current code:
Private Sub Form_Load()
Dim strNextNumber As String
strNextNumber = Nz(DMax("ID", "General Housing Survey"), 0) + 1
Me.ID = strNextNumber
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intResponse As Integer
intResponse = MsgBox("Save Record?", vbYesNoCancel)
Select Case intResponse
Case vbYes
'Do Nothing
Case vbNo
Me.Undo 'To undo the edit
Case vbCancel
Cancel = True 'To cancel the update & hence the close
End Select
End Sub
Private Sub Command75_Click()
On Error GoTo Err_Command75_Click
Dim strDocName As String
Dim strID As String
If intresponseall = yes Then
strDocName = "Water"
strID = Me.ID
DoCmd.Close
DoCmd.OpenForm strDocName
Forms(strDocName)!ID = strID
End If
Exit_Command75_Click:
Exit Sub
Err_Command75_Click:
MsgBox Err.Description
Resume Exit_Command75_Click
End Sub