On my form, when I move to a new record, the "RecNum" field is populated with the data from the previous record. The problem is that it only works if the "Recnum" field receives the focus.
I want the focus to move to the RecNum field to trigger its "On Focus" event when the user clicks the date field. I have a "On focus" event for the date field to do this. However, I receive the message that the focus cannot be moved to the "RecNum" field. I was hoping there was another way of triggering the RecNum event.
Private Sub RecNum_GotFocus()
SendKeys "^'", True
ServPro.SetFocus
If IsNull(ServPro) Then SendKeys "^'", True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToControl "doe"
End Sub
Private Sub DOE_GotFocus()
If IsNull([RecNum]) Or IsNull([ServPro]) Then
RecNum.SetFocus
End If
Rather than have your code in the GotFocus event, move it to a separate sub in the form. You can then call this sub from anywhere in the form that you need to (including the GotFocus event.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.