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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top