A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open a Form at a Specific Time



 
 
Thread Tools Display Modes
  #1  
Old January 13th, 2010, 05:46 PM posted to microsoft.public.access.forms
User via AccessMonster.com
external usenet poster
 
Posts: 28
Default Open a Form at a Specific Time

I would like to open a form at a specific time of the day, everyday.

Please help?

--
Message posted via http://www.accessmonster.com

  #2  
Old January 13th, 2010, 06:43 PM posted to microsoft.public.access.forms
NuBie via AccessMonster.com
external usenet poster
 
Posts: 67
Default Open a Form at a Specific Time

Scheduled Tasks should do what you want.

Steps
1. Open Control Panel
2. Look for Scheduled Tasks and double click it.
3. Click Add Scheduled Task then follow the wizard

hope that helps

User wrote:
I would like to open a form at a specific time of the day, everyday.

Please help?


--
spread the WORD

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #3  
Old January 13th, 2010, 07:09 PM posted to microsoft.public.access.forms
User via AccessMonster.com
external usenet poster
 
Posts: 28
Default Open a Form at a Specific Time

I'm sorry for the mix up, I should've been more specific.

The operation I need takes place within an already opened access form.

The main form stays open and at a specific time of day another form opens
within the same database. I would like the operation to occur every day at
the specified time.

Thanks

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 13th, 2010, 08:04 PM posted to microsoft.public.access.forms
NuBie via AccessMonster.com
external usenet poster
 
Posts: 67
Default Open a Form at a Specific Time

use the Form.Timer Event

here's a sample code. tweak it to suit your needs

Private Sub Form_Load()
Form.TimerInterval = 1000 ' set time interval
End Sub

Private Sub Form_Timer()
Label1.Caption = Time
End Sub


User wrote:
I'm sorry for the mix up, I should've been more specific.

The operation I need takes place within an already opened access form.

The main form stays open and at a specific time of day another form opens
within the same database. I would like the operation to occur every day at
the specified time.

Thanks


--
spread the WORD

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #5  
Old January 13th, 2010, 08:07 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Open a Form at a Specific Time

"User via AccessMonster.com" u36225@uwe wrote in message
news:a20f27d793c46@uwe...
I would like to open a form at a specific time of the day, everyday.



This can only be done if the database itself is open at that time of day,
every day. If you need to, you can use the system's task scheduler to make
that happen. But from a later message in this thread, I think you are
assuming that the database will be open, and not only that, that a specific
form will also always be open. In that case, you can use the Timer event of
that form (your "main form") to open the new form.

You would set the form's TimerInterval to some suitable value; say, 60000,
which would make it fire every minute. The exact value will depend on how
precise your timing needs to be. You would have an event procedure for the
Timer event that would determine whether the current time is the time at
which you want to open the other form, *and also* whether it has already
been opened today. If it's time to open it -- or past time -- and the form
hasn't yet been opened, the code would proceed to open it.

The exact method for determining whether the form has been opened already
today depends on things you haven't yet told us. Will the database and the
main form remain open from day to day, without ever being closed? I
wouldn't want to count on that. Will the main form be opened more than once
a day? If it's opened once and only once a day, then you might just turn
off the Timer event by setting the TimerInterval to 0 once you've opened the
second form -- if you aren't using the Timer event for anything else. Or
you could record, in a database table, the date on which the second form was
last opened, and check that before opening the form again.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #6  
Old January 13th, 2010, 08:28 PM posted to microsoft.public.access.forms
User via AccessMonster.com
external usenet poster
 
Posts: 28
Default Open a Form at a Specific Time

Will the database and the main form remain open from day to day, without ever being closed?
No, but the database is often left open from day to day.

Will the main form be opened more than once a day?

Yes, the main form is opened many times throughout the day.

if you aren't using the Timer event for anything else

I’m using the Timer to display the current system time on the main form.

--
Message posted via http://www.accessmonster.com

  #7  
Old January 13th, 2010, 08:46 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Open a Form at a Specific Time

"User via AccessMonster.com" u36225@uwe wrote in message
news:a21093b5cba31@uwe...
Will the database and the main form remain open from day to day, without
ever being closed?

No, but the database is often left open from day to day.

Will the main form be opened more than once a day?

Yes, the main form is opened many times throughout the day.

if you aren't using the Timer event for anything else

I’m using the Timer to display the current system time on the main form.



Then you have no choice but to record in the database the last date on which
the second form was opened. Suppose you have a table, "Settings", and in
that table you have a date/time field named "FormLastOpened" (of course
these are example names). Your form might have code like the following in
its module:

'------ start of example code ------
Option Compare Database
Option Explicit

Dim mdtFormLastOpened As Date

Private Sub Form_Open(Cancel As Integer)

' Look up and save the date on which the
' secondary form was last opened.

mdtFormLastOpened = _
Nz(DLookup("FormLastOpened", "Settings"), 0)

End Sub

Private Sub Form_Timer()

' ... code to update the time display on this form ...

' See if we should open the second form.
If mdtFormLastOpened Date() Then
If Time() = #12:00 PM# Then ' PUT DESIRED TIME IN THIS STATEMENT
mdtFormLastOpened = Date()
DoCmd.OpenForm "YourSecondForm"
DBEngine(0)(0).Execute _
"UPDATE Settings SET FormLastOpened = Date()", _
dbFailOnError
End If
End If

End Sub
'------ end of example code ------

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #8  
Old January 13th, 2010, 08:52 PM posted to microsoft.public.access.forms
NuBie via AccessMonster.com
external usenet poster
 
Posts: 67
Default Open a Form at a Specific Time

Try this and see what happens

Private Sub Form_Load()
Form.TimerInterval = 60000 ' initially fire it every minute
End Sub

Private Sub Form_Timer()
hours = Format(Time, "h")
If hours = 9 Then 'reset time interval at 9:00am or whatever
Form.TimerInterval = 180000 'fire it every 3 hours instead of every
minute
End If

Select Case hours
Case 9, 12, 15 'open forms at 9 AM, 12 noon, 3 PM
'open form2 here
MsgBox hours
End Select

End Sub

User wrote:
Will the database and the main form remain open from day to day, without ever being closed?

No, but the database is often left open from day to day.

Will the main form be opened more than once a day?

Yes, the main form is opened many times throughout the day.

if you aren't using the Timer event for anything else

I’m using the Timer to display the current system time on the main form.


--
spread the WORD

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #9  
Old January 13th, 2010, 09:37 PM posted to microsoft.public.access.forms
User via AccessMonster.com
external usenet poster
 
Posts: 28
Default Open a Form at a Specific Time

Then you have no choice but to record in the database the last date on which
the second form was opened.


It seems like we may have gone a little off the track.

If the main form is left open, the second form should only open when the
system time is equal to 6:00pm.

Any other ideas?

--
Message posted via http://www.accessmonster.com

  #10  
Old January 13th, 2010, 09:38 PM posted to microsoft.public.access.forms
User via AccessMonster.com
external usenet poster
 
Posts: 28
Default Open a Form at a Specific Time

It seems like we may have gone a little off the track.

If the main form is left open, the second form should only open when the
system time is equal to 6:00pm.

Any other ideas?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.