Hi All,
I have the following code behind the After Update Event of my text box.
The problem I am having is that when you get the warning message and you press okay the cursor moves to the next field. Is there any way of getting the cursor to stay in the same text box?
Any help would be appreciated
Spike



I have the following code behind the After Update Event of my text box.
The problem I am having is that when you get the warning message and you press okay the cursor moves to the next field. Is there any way of getting the cursor to stay in the same text box?
Code:
Private Sub ZNumber_AfterUpdate()
Me.ZNumber = UCase(Me.ZNumber)
Dim Z_Number As String
Dim stLinkCriteria As String
SID = Me.ZNumber.Value
stLinkCriteria = "[ZNumber]=" & "'" & SID & "'"
'Check Sendaway table for duplicate ZNumber
If DCount("ZNumber", "tblSendaways", _
stLinkCriteria) > 0 Then
ZNumber = Null
'Message box warning of duplication
MsgBox "Warning Z Number" _
& SID & " has already been entered", vbOKOnly, "Action Required"
End If
Me.ZNumber.SetFocus
End Sub
Any help would be appreciated
Spike


