Code for save Button

paultri

Registered User.
Local time
Yesterday, 20:20
Joined
May 19, 2003
Messages
19
I need to create code for a save button so that the form is saved and then cleared but only have the data saved if text box "Q24" is populated with either "Yes", "No" or "Don't Know", and if "Q24" is NOT populated when clicking the save button the form is just cleared without saving the data. any help is appreciated as i have no idea where to even begin with this!

Thanks in advance!

Paul
 
The code for the click event of the Save button is:

DoCmd.RunCommand acCmdSaveRecord

The other code needs to go in the BeforeUpdate event of the form:

Code:
Select Case Me.Q24
    Case "Yes", "No", "Don't Know"
    Case Else
        Cancel = True
        Me.Undo
        MsgBox "Record Not Saved", vbOKOnly
End Select
 

Users who are viewing this thread

Back
Top Bottom