Hi
I have one that is doing my head in.
I need to test that a Job Number has not been used before. If it has there is a very slight chance they might want to re-use it. The relevant bit of my code (in the BeforeUpdate event) is
I have one that is doing my head in.
I need to test that a Job Number has not been used before. If it has there is a very slight chance they might want to re-use it. The relevant bit of my code (in the BeforeUpdate event) is
Code:
' Verify if job number has already been used
varJob = DLookup("lngJob", "tblJobs", "[strJobNo] = '" & Me.txtJobNo & "'")
' If job number has been already used check with user
If Not IsNull(varJob) Then
' Advise user
varResponse = MsgBox("This job number has already been used." & vbLf & vbLf & "Are you sure you want to re-use it?", vbYesNo, "Duplicate job number - Confirmation required")
If varResponse = vbNo Then
Cancel = True
Undo
End If
End If
[\CODE]
When I run it and deliberately use a duplicated number it picks it up and gives me the message. When I say no it retains the entered number with the cursor flashing at the end of the number. I want it to remove the entered number and mae it clear another number needs to be entered.
What is it I am missing? It has been a long weekend so I guess I may kick myself when someone is able to point out the obvious :-)
Thanks for any input