is there a way i can make it so they can fill out a form but it doesnt save
it to the table until they click the next button to go to next form of the
survey?????
i want this because if i was just to show someone the form(ie open it, i
coded it to assign an ID # to ID field upon opening). and then after
showing the person the form, just closed it, it would still save a record
in the table with the newly assigned ID# and all the other fields blank.
reservedbcreater - 27 Jan 2005 20:25 GMT
i fixed this with
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
John Vinson - 27 Jan 2005 21:36 GMT
>is there a way i can make it so they can fill out a form but it doesnt save
>it to the table until they click the next button to go to next form of the
[quoted text clipped - 4 lines]
>showing the person the form, just closed it, it would still save a record
>in the table with the newly assigned ID# and all the other fields blank.
You can put code in the Form's BeforeUpdate event to check to see if
it's valid to save. For instance you could put a statement
Dim bOkToClose As Boolean
before the first Sub in the Form's module; set this variable to False
in the form's Current event, and to True in the click event of your
"save" button. Then in the Form's BeforeUpdate event put something
like
Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If Not bOkToClose Then
iAns = MsgBox("Please use the Save button, or select " _
& " Cancel to erase this screen", vbOKCancel)
Cancel = True
If iAns = vbCancel Then
Me.Undo
End If
End If
End Sub
John W. Vinson[MVP]