J
Jim Hess
I'm using Access 2002. I need code that will alert the user that there is a
duplicate requisition number as soon as user moves from the requisition
number field. This is the code I originally used and it worked in Access
2000:
Private Sub REQNUM_AfterUpdate()
'Code came from ZDJournal reply
'TVCodeTools ErrorEnablerStart
On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim My_REQNUM As String
My_REQNUM = [ReqNum].Value
If IsNull(DLookup("[REQNUM]", "MSTRREQ", "[REQNUM] = '" & My_REQNUM &
"'")) = False Then ' If the REQNUM exists already
MsgBox "REQNUM = " & My_REQNUM & " is already on file"
' The next entry cancels the current record entry
SendKeys "{ESC}", 200
' The next 2 lines bring up the record with the particular REQNUM
Me.RecordsetClone.FindFirst "[REQNUM] = '" & My_REQNUM & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
Exit Sub
PROC_ERR:
MsgBox Err.Description
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
As you can see, I have some of the FMS tools. My problem is that this
function no longer works and I don't know how to fix it. Can someone help?
duplicate requisition number as soon as user moves from the requisition
number field. This is the code I originally used and it worked in Access
2000:
Private Sub REQNUM_AfterUpdate()
'Code came from ZDJournal reply
'TVCodeTools ErrorEnablerStart
On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim My_REQNUM As String
My_REQNUM = [ReqNum].Value
If IsNull(DLookup("[REQNUM]", "MSTRREQ", "[REQNUM] = '" & My_REQNUM &
"'")) = False Then ' If the REQNUM exists already
MsgBox "REQNUM = " & My_REQNUM & " is already on file"
' The next entry cancels the current record entry
SendKeys "{ESC}", 200
' The next 2 lines bring up the record with the particular REQNUM
Me.RecordsetClone.FindFirst "[REQNUM] = '" & My_REQNUM & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
'TVCodeTools ErrorHandlerStart
PROC_EXIT:
Exit Sub
PROC_ERR:
MsgBox Err.Description
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
As you can see, I have some of the FMS tools. My problem is that this
function no longer works and I don't know how to fix it. Can someone help?