I have a form in access that lets the user enter data. The data is information taken over the phone from a caller about someone who has committed a liter violation. Once the data has been entered the user hits the send letter button and it prints a letter in word to send a warning to the violator. I need the code to run a check to see if that violator already has a record.
When the user enters the data, i need for it to tell me that this person already has a record if one is there for them. and give a "second warning" message.
here is my code for the send letter button.
- Private Sub cmd_Send_Click()
-
'checks to see if both checkboxes are checked (Letter Sent & 2ndWarning)
-
If CkSentBoxesNone Then Exit Sub
-
'checks to see if Do Not Send checkbox is checked - If true, give msgbox warning
-
If CkDoNotSend = True Then Exit Sub
-
-
PrintWarningOne
-
-
End Sub
-
-
-
-
' insures both LetterSent & 2ndWarning checkboxes aren't BOTH unchecked
-
Private Function CkSentBoxesNone() As Boolean
-
-
If ([Forms]![frm_Input_frm]![LetterSent] = False) And ([Forms]![frm_Input_frm]![2ndWarning] = False) Then
-
MsgBox "You must check either ""Letter Sent"" or ""2nd Warning"" checkbox " & vbCrLf _
-
& "for this call/violation." & vbCrLf & vbCrLf _
-
& "Please choose only one checkbox.", vbOKOnly, "Choose One Checkbox"
-
CkSentBoxesNone = True
-
Else: CkSentBoxesNone = False
-
End If
-
-
End Function
-
-
' checks to ensure Do Not Send box is not checked when a letter is generated
-
' if it is, a MsgBox warning is issued but user can override and still print
-
Private Function CkDoNotSend() As Boolean
-
-
Dim response As Integer
-
-
If [Forms]![frm_Input_frm]![DoNotSend] Then
-
response = MsgBox("The ""Do Not Send"" box is checked on this record. " & vbCrLf & vbCrLf _
-
& "Are you sure you want to print this letter?", 36, "Do Not Send Checked")
-
If response = 6 Then
-
CkDoNotSend = False
-
Else: CkDoNotSend = True
-
End If
-
Else: CkDoNotSend = False
-
End If
-
-
End Function