zero_cool
Aug 10 2005, 11:07 PM
Hey everybody,
I have a IF function that runs on my form. After END IF I have the command Me.PeriodFrom.SetFocus
When the code runs however, the focus is not returned to this control and instead passes to the next one in the tab list. Is there some rule about where the setfocus command must be placed that I don't know about?
Thanks in advance.
freakazeud
Aug 10 2005, 11:14 PM
Hi,
what code are you using. Where are you fireing it, where is the focus at that moment, where do you want the focus to go to...
Maybe you can clarify those things so we get a better idea of what it is you are trying to achieve.
HTH
Good luck
zero_cool
Aug 11 2005, 05:36 PM
Private Sub PeriodFrom_LostFocus()
If IsNull(Me.ExpenseID) = True Then
MsgBox ("You must enter a Period From date before proceeding")
End If
Me.PeriodFrom.SetFocus
End Sub
That is an extract of the code which should answer most of your questions. I did have Me.PeriodFrom.SetFocus within the IF function. I was moving it around to try and understand what the best sequence was.
JayNoelOlimpo
Aug 11 2005, 05:41 PM
Hi;
Use Before Update Event procedure ...
CODE
If IsNull(ExpenseID) Then
MsgBox ("You must enter a Period From date before proceeding")
Cancel = True
End If
HTW.
zero_cool
Aug 14 2005, 08:38 PM
Hi,
I tired entering that code and it did not really do what i wanted it to.
I have a mainform (with the ExpenseID on) and a subform. When the user enters a date (in Period From) the expense ID is generated. If they move into the subform without a expense ID being generated then it generates an error because there is no link. I want to prevent that by not letting the focus move from the Period From box until a date has been entered.
Hope that makes sense.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.