I have this code in a controls before update, what I want is to warn the operator that he is entering a number that has already been used but be able to click yes and continue and use the same number. what I am missing is between these lines
If intResponse = vbYes Then
Else
I have duplicate as YES duplicates OK in the table.
Private Sub MPC_Number_BeforeUpdate(Cancel As Integer)
On Error GoTo ProcError
Dim rs As Object
Dim z As Variant
Dim intResponse As Integer
z = DLookup("[MPC_Number]", "[T_Components]", "Trim([MPC_Number]) = '" & Trim(Me.[MPC_Number].Value) & "'")
If Not IsNull(z) = True Then
intResponse = MsgBox("This MPC Number has already been Entered, Would you like to re-use this number? ", _
vbYesNo + vbQuestion, "Duplicate Number Entered")
If intResponse = vbYes Then
*************************************
***************************************
Else
Me.Undo
Cancel = True
End If
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure MPC_Number_BeforeUpdate..."
Resume ExitProc
End Sub
Jumat, 24 Juni 2011
[MS_AccessPros] Before Updat
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar