Setting focus on command button. (1 Viewer)

Rapsens

New member
Local time
Today, 07:22
Joined
Dec 16, 2020
Messages
3
Hello Everyone.

I have a form that has a subform in it. The form header contains a textbox that has the purpose to search the subform. And I need to keep track of the last time that a search was made. I need to make this process automatic. So what i have done is the following:

textbox on header has the following:

Code:
Private Sub srchnum_AfterUpdate()
DoCmd.Requery "query srchnum subform"
Me.query_srchnum_subform.SetFocus
Me.query_srchnum_subform![lastsrch].SetFocus
End Sub

then another textbox on the subform has the followin:

Code:
Private Sub lastsrch_GotFocus()
Me.lastsrch = Now
End Sub

after this I need to set focus on a button on the same subform

I tried doing this using Afterupdate on lastsrch, but I can´t find a way to do so.

Can anyone shed some light on this?

Thanks to everyone in advance.

Cheers.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:22
Joined
Oct 29, 2018
Messages
21,454
Maybe you could try something like:
Code:
Private Sub lastsrch_GotFocus()
 Me.lastsrch = Now 
 Me.CommandButtonName.SetFocus
End Sub
 

Rapsens

New member
Local time
Today, 07:22
Joined
Dec 16, 2020
Messages
3
Maybe you could try something like:
Code:
Private Sub lastsrch_GotFocus()
Me.lastsrch = Now
Me.CommandButtonName.SetFocus
End Sub
Nailed it! Thank you so much for your help! :D(y)
 

Users who are viewing this thread

Top Bottom