help with prompting user to save records

  • Thread starter reservedbcreater
  • Start date
R

reservedbcreater

what i want to happen in when the user is done
filling out the form, and they click next,
access asks the user if they want to save the
record> if yes, it saves and goes to next form,
if no it just stays on current form and doesnt
save.


Option Compare Database
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


strDocName = "Water"
strID = Me.ID
DoCmd.Close
DoCmd.OpenForm strDocName
Forms(strDocName)!ID = strID



Exit_Command75_Click:
Exit Sub

Err_Command75_Click:
MsgBox Err.Description
Resume Exit_Command75_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top