set focus

teiben

Registered User.
Local time
Today, 12:44
Joined
Jun 20, 2002
Messages
462
This is what I have on my form after update event:

I want it to give the user the opportunity to put a value in txtPrintNumber, but NO matter where I put the setfocus, it doesn't work.


Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.chkMathdata) And IsNull(Me.txtPrintNumber) Then
'Me.txtPrintNumber.SetFocus
MsgBox "You must enter a valid Print Number, since you are supplying Math Data"
Cancel = True
Me![txtPrintNumber].SetFocus
End If
End Sub
 
It does cancel, I have also played with moving the cancel = true.
 
Me.txtPrintNumber.SetFocus
 
I don't know if you were ever able to work this out but I stumbled on to a solution (I had exactly the same issue). Try this. Set the focus to a different control first and then immediatly return to the control that you want the focus on. Like this.....
me.dummyfocus.setfocus
me.theoneiwant.setfocus
This seems to work....
Pete
 
I had this problem not too long ago and it was driving me nuts. I thought I was doing something wrong. Guess I'm not the only one. *regains sanity* :D
 

Users who are viewing this thread

Back
Top Bottom