I have like 2 or 3 validation techniques on one field, most of which are triggered by clicking the Save button. One of these techniques checks to see if data in the field is present, the other is to format the date with a msgbox dd/mm/yyyy.
But also, on the Save button click function there is a confirmation box to proceed or cancel the save.
However this method doesn't work for me..If I try saving the record without anything in validated field, a box comes up saying 'Must enter data here bla bla', so you click OK, but then the command button one runs too saying its been saved.. I don't want it to save the record if the validation has popped up basically.. Heres the code:
Thanks!
But also, on the Save button click function there is a confirmation box to proceed or cancel the save.
However this method doesn't work for me..If I try saving the record without anything in validated field, a box comes up saying 'Must enter data here bla bla', so you click OK, but then the command button one runs too saying its been saved.. I don't want it to save the record if the validation has popped up basically.. Heres the code:
This was a tough one to explains :S..Private Function ConfirmEntries() As Boolean
'Purpose: Checks whether entries have been made in the
'following textboxes and displays a message for any null
'values or empty boxes
If IsNull(Me.Start_Date) Then
MsgBox "Please enter member Start_Date"
Start_Date.SetFocus
ConfirmEntry = True
Exit Function
End If
If IsNull(Me.Exp_Date) Then
MsgBox "Please enter member Exp_Date"
Exp_Date.SetFocus
ConfirmEntry = True
Exit Function
End If
End Function
Private Sub cmdSaveDetails_Click()
Dim mbrResponse As VbMsgBoxResult
Dim str As String
DoCmd.RunCommand acCmdSaveRecord
ConfirmEntries
mbrResponse = MsgBox("You have chosen to add a subscription to member: " & Me.F_Name & ".", vbInformation + vbOKCancel, "Confirm Choice")
If mbrResponse = vbOK Then
'if OK was clicked
mbrResponse = MsgBox("Confirmed choice " & Me.F_Name & " " & Me.L_Name & ".", vbInformation + vbOKCancel, "Confirm Choice")
Else
'if Cancel was clicked
MsgBox "Subscription Cancelled"
End If
End Sub
Thanks!