Revision: 26177
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 19, 2010 18:40 by cdevitt
Initial Code
Private Sub chkITRelated_AfterUpdate()
Dim stDocName As String
Dim stLinkCriteria As String
Dim intAnswer As Integer
Dim strSQL As String
stDocName = "frmITRelated"
stLinkCriteria = "[Barcode]=" & Me![Barcode]
If chkITRelated.Value = True Then
Me.btnEditITData.Visible = True
If DCount("*", "tblITRelated", stLinkCriteria) = 0 Then
intAnswer = MsgBox("The barcode was not found!" & vbCrLf & "Would you like to add it to the IT Related table now?", vbExclamation + vbYesNo, "Error!")
If intAnswer = vbYes Then
strSQL = "INSERT INTO tblITRelated([Barcode])" & "VALUES ([Barcode]);"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The barcode has been added!", vbInformation, "Great Success!"
Response = acDataErrAdded
DoCmd.OpenForm stDocName, , , stLinkCriteria
ElseIf intAnswer = vbNo Then
MsgBox "Clearing IT Related checkbox...", vbInformation, "Oh noes!"
chkITRelated.Value = False
Response = acDataErrContinue
End If
'ElseIf
'DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Else
Me.btnEditITData.Visible = False
End If
End Sub
Initial URL
Initial Description
Initial Title
MsgBox if statement
Initial Tags
Initial Language
VB.NET