hello i have a button on my form with some textboxes bounded to a table. when i press a button i have some validations running, however even if the validations run through, it still adds the values that the user inputs in the textboxes into the table.
please help, thanks!
this is the code of the button, a picture is below. format of the text in the box is string. basically it doesnt matter what msgbox validation comes up, it still adds to the table its bounded to. i want to make it NOT add to the table if it the validation catches an error.
Private Sub btngo_Click()
Dim x As String
x = DCount("*", "tblCustomerMaster", "CustomerID = '" & Me.frmtest.Form.Channel_ID & "'")
If Me.LAN_ID <> "tshc" And Me.LAN_ID <> "rgv1" And Me.LAN_ID <> ("hxcm") And Me.LAN_ID <> ("j0hu") And Me.LAN_ID <> ("R2Wq") And Me.LAN_ID <> ("NSC4") And Me.LAN_ID <> ("ECD1") And Me.LAN_ID <> ("S2Bf") And Me.LAN_ID <> ("KKW2") Then
MsgBox ("ERROR: You Don't Have Authorization!")
ElseIf Me.frmtest.Form.Due_Date <= Date - 1 Then
MsgBox ("ERROR: This is not a possible Due Date!")
ElseIf x = 0 Then
MsgBox ("ERROR: Invalid Channel ID")
ElseIf Me.frmtest.Form.Due_Date <> "" And Me.frmtest.Form.Channel_ID <> "" Then
DoCmd.GoToRecord , , acNewRec
DoCmd****nMacro ("mcrHHFRequest_Tais")
MsgBox ("You've Added A Record(s)!")
DoCmd****nMacro ("mcrCloseEasyTrakEnter")
DoCmd.OpenForm "frmeasytrak", acNormal
Else
MsgBox ("ERROR: Missing a Field")
End If
End Sub
picture:
http://i130.photobucket.com/albums/p...rmeasytrak.jpg