On Timer to redisplay a form

Gkirkup

Registered User.
Local time
Yesterday, 19:12
Joined
Mar 6, 2007
Messages
628
I have a display-only form, which I need to redisplay every few minutes. I see the 'On Timer' selection for the form, but it says [Event procedure]. What do I need to enter as an event procedure to redisplay the form, or more accurately the data?

Robert
 
You put your code to open the form or refresh the forms data in the 'On Timer' event. You also need to set the 'Timer Interval' (in milliseconds).
 
Ken: Thanks. This is my first time in this code area. What would be the type of code I would use to refresh the form's data? I was reading up on me.requery and me.repaint, but don't know how to use those.

Robert
 
Ken: Thanks. This is my first time in this code area. What would be the type of code I would use to refresh the form's data? I was reading up on me.requery and me.repaint, but don't know how to use those.

Robert

I would think the me.requery would work.
 
Ken:
I did try just typing in me.requery between the square brackets and got an error message. I suspect that I have to do more than that. What do I need to do? Thanks for your help.

Robert
 
The '[Event Procedure]' you see is simply letting you know that there is some VBA code (Or at least a place holder) for that event. If you put your cursor in the space where this message appears you should see a small button with ellipses (three consecutive dots or periods '...'. Clicking on this button should take you into the VBA editor where you can put your code.

If this is your first go at code I would suggest you get something simple to work like maybe putton the following code in a butons click event:

msgbox "Hello World"

As an alternate to code, you could call a macro to do a requery, but code is more flexible...
 
Instead of event procedure, click the three dots next to the drop down and go to the code builder.
Code would be similar to this

Private Sub FormName_Timer()
Me.Requery
End Sub

Then set your timer length in millseconds (numbr of seconds x 1000) in the form properties.
 
Thanks so much. I will give that a try! By the way, I am confused between VBA and SQL. Both are in Access? Do I need to learn both?

Robert
 
Edfred: No problem with code builder. Sorry to be a bit dense, but it's my first time along this path. What do I write in the On_Time box, where [Event procedure] is now? I tried entering the procedure name, both with and without square bracket, but now it's saying 'Macro not recognized'.
I appreciate your help.
Robert
 
What do I write in the On_Time box, where [Event procedure] is now? I tried entering the procedure name, both with and without square bracket, but now it's saying 'Macro not recognized'.
I appreciate your help.
Robert

See post #6 ;)
 

Users who are viewing this thread

Back
Top Bottom