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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a windows that pops every hour? 2

Status
Not open for further replies.

diezzz

Technical User
Oct 11, 2006
28
HU
Hello,

I'm trying to create a form that will pop-up every 60 minutes.
I have no ideea how this could be done, i can't manage to build an event or something to make it pop every hour.

Can it be done or are there any alternatives?

Thanks for your answer,
Diez
 
How are ya diezzz . . .

You need a [blue]hidden form with a timer running![/blue]

With the [blue]Timer Interval[/blue] event set to 60000 the [blue]On Timer[/blue] event would look like:
Code:
[blue]   If Not CurrentProject.AllForms([purple][b][i]PopupFormName[/i][/b][/purple]).IsLoaded Then
      DoCmd.OpenForm "[purple][b][i]PopupFormName[/i][/b][/purple]"
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Your Thoughts? . . .

Looks good if the OP wants the msgbox every hour from point of opening, but if the OP wanted to pop the msgbox up at a specific time (e.g. every hour on the hour) something like:

Code:
Dim strTime As String
Static s As Integer
strTime = Mid(TimeValue(Now()), 4, 2)
If strTime = "09" And s = 0 Then
    MsgBox "Now"
    s = 1
Else
    s = 0
End If

Note: I used Mid(TimeValue(Now()), 4, 2) to 'handle' different date formats (i.e. effectively remove the date format from the equation) but to remove a potentially unneccesary function from the proc, you could get rid of TimeValue and 'rework' the mid start point.

HTH
Jim
 
Ooops, meant to add that you should set the timer event to 30000 (30 seconds)
 
Howdy jimirvine . . .

Yeah . . . [blue]diezzz[/blue] didn't specify so I decided to go relative. However for [blue]on the hour[/blue] I would've posted:
Code:
[blue]   If Format(TimeValue(Now()), "nn") = "00" Then
      If Not CurrentProject.AllForms(PopupFormName).IsLoaded Then
         DoCmd.OpenForm "PopupFormName"
      End If
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
I've been up over 72 hours now and am a bit fuzzy, AceMan1, wouldn't Timer Interval event set to 60000 cause your code to happen every sixty seconds not sixty minutes? Timer Interval equals one second per 1000/TimeInterval.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
If Format(TimeValue(Now()), "nn") = "00" Then

MUCH tidier than mine [thumbsup2] , especially if you just make it

Code:
If Format(Now(), "nn") = "00" Then ...

Not sure about the
Code:
If Not CurrentProject.AllForms(PopupFormName).IsLoaded
as presumably, the OP will close the form when it first pops up, would that not mean that the form could still, potentially open twice in the same minute (I could be wrong, I very often am ;) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top