Form Code Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I have the attached code in AfterUpdate of a field that selects a
project number. What I would like to have happen is when the land on the
field, select 0080 and it is incorrect and they say No, that it goes back to
the field and stays there until they change it, but this isn't working, it is
just carrying on to the next code. I thought the 'SetFocus' would keep it
there but it doesn't seem to be working. Any help gratefully accepted.
IEJ

Private Sub OurProjectNumber_AfterUpdate()

Dim Message As String

If OurProjectNumber.Value = "0080" Then

If MsgBox("You have selected the VProject Number. Is this the " _
& "Project Number you want?", vbYesNo + vbQuestion) = vbNo Then
MsgBox ("Please select correct Project Number from dropdown list")
Me.OurProjectNumber.SetFocus
End If
 
Hello,

Move the code to the Before Update Event & then if you want to keep the focus,
put Cancel = true; remove the Me.OurProjectNumber.SetFocus.

Jeff
 
Back
Top