Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form refresh automatically

Status
Not open for further replies.

pcrmil

Programmer
Sep 11, 2008
16
US
Hi All,

I have a database shared on a network. If a user is entering data on a form, how do I get the information updated to an open form on the second user's computer automatically with the timer every 2 mts, without hitting shift F9 or the refresh button? i will be greatly thankful if you can help me.


 
G'day pcrml,

Try On Timer event -

Code:
me.requery

I think the Timer Interval property is to be set in milliseconds so try 120000 for 2 mins.

JB
 
Thanks JB

I am a new program. Could you please explain to me in detail about the Time intervel property so i can set it. Also please give me a step by step, on where can I write the code . Thank you.
 
In the form, go to Properties page, the Event, then find the OnTimer Event.

Click the build button, selecting Visual Basic code if prompted.

In the spave you are in (betwwen for Form_OnTimer and End Sub enter:

me.requery

Close and save the form. Open it again and test!

Note that if your form will probably reset to the first record every two minutes now - annoying if it is single record or contiuous view.

SeeThru
Synergy Connections Ltd - Telemarketing Services

 
g'day pcmril,

seethru is spot on with writing the event, setting the timer interval is even easier - you've probably got it by now but there's a property on the form property sheet called timer interval. Simply type 120000 in there and save.

To test it's all working ok, add to your ontimer event:

msgbox("Refreshing")

and set the timer interval to 20000 and ensure it pops up "Refreshing" msg every 20 seconds.

As seethru pointed out this may result in the form jumping to the first record. If this happens we can use something called a bookmark to reset focus to the relevant record.

Request help on that in another post if required :)

Good luck mate,

JB
 
Hi JBinQLD and SeeThru

Thanks to the both of you for your time explaining it to me,It works.


JB that is correct, the cursor on the form is jumping into the first record. How can I use the bookmark to reset to the relevant record. Please explain it to me.

Thanks so much
 
pcrmil,

Easier idea - change the line me.requery to me.refresh as this doesn't reset to first record :)

JB
 
Hi, JBinQLD and Seethru

Thanks to the both of you . Me.refresh is not showing the newly added records. I used Me.requery . I entered the time interval every two minutes and its requering, but while in the process of entering the data/editing etc the hour glass is staying until the requery/update done.

Is there any way to update records automatically with out disturbing the add/edit records?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top