GotFocus() Requery question (1 Viewer)

eibyer_apc

New member
Local time
Today, 09:08
Joined
Mar 1, 2022
Messages
18
I created a landing form with `="Date: " & Date()` field that I would like to update automatically.

After doing some reading, I found suggestions of using GotFocus() event and Me. Requery to update the form but it doesn't seem to be working for me. What am I missing?

Here's the date I'm wishing to update. I would like to add more items to requery but just starting off with the simple date.
1660325945315.png



1660326092182.png


1660326119876.png
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:08
Joined
Feb 19, 2013
Messages
16,627
form gotfocus event wont work if it has any visible and enabled controls - which presumably the two buttons are. See this link


given the date only changes every 24 hours, think you need to define what 'periodically' means
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:08
Joined
Oct 29, 2018
Messages
21,485
Hmm, exactly "when" do you want the update to happen (automatically)?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:08
Joined
Aug 30, 2003
Messages
36,127
A couple of other thoughts. I might try the activate event rather than the focus event, or maybe the timer event if you want it on some sort of schedule. For the textbox, you may need to requery the textbox rather than the form, since it isn't displaying something in the form's record source..
 

eibyer_apc

New member
Local time
Today, 09:08
Joined
Mar 1, 2022
Messages
18
Ah, that makes sense. I have these queries on the form also that I'd like to update. I can make a refresh button but if possible, I'd prefer it to be automatic or maybe even a set interval.

1660326989779.png
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:08
Joined
Aug 30, 2003
Messages
36,127
Happy to help! If you want it done at a set interval, take a look at the timer event of the form.
 

eibyer_apc

New member
Local time
Today, 09:08
Joined
Mar 1, 2022
Messages
18
Happy to help! If you want it done at a set interval, take a look at the timer event of the form.
That's exactly what I did. I had played with On Timer event before I tried GotFocus, your hint got me into the right direction.
 

Users who are viewing this thread

Top Bottom