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

Question, does the timer continue on a open hidden form?

Status
Not open for further replies.

AccessDevJunior

Programmer
Apr 14, 2004
81
GB
hya,

this is the scenario:

if the user wishes to receive a call back reminder they tick a box and update [date] field and [time] field with the date and time they would like the call back.

the switchboard is always open and when it does open up it also opens open another form [frm_CallBackReminder] this is 'hidden'.

This is the code on the hidden form timer:

If DLookup("[Date]", "tbl_CallBackReminder", _
"[Date] = [Forms]![frm_CallBackReminder]![Date]") And DLookup("[Time]", "tbl_CallBackReminder", _
"[Time] = [Forms]![frm_CallBackReminder]![Time]") Then

(then there is some code to send an email through lotus notes to remind the user)

there are 2 fields on the hidden form [Date] and [Time] the date field =Date() and the Time field =Time() <<updates every second.

im having problems getting the database to send the email when both dates and times match up. Is it because the hidden form has not got focus and so the timer stops?
 
No, the timer does not stop on an hidden form regardless of whether it has focus or not. What you might want to try doing is to create a public variable that contains the DateTime to be notified. In your OnTimer event, just check the current date/time with the value of the public variable. That way you're not hitting the database so much.
 
I tried taking away the dlookup on the [time] field and timer on the hidden form works, i received about 50 emails as the code was send an email every second for the current date.
This is why i need to lookup the time the user has entered so it only sends just the one email
 
That doesn't make sense (unless I don't understand what you're trying to do). Say that the user wants to be notified at 10/12/2004 09:00. Your public variable is set to that date/time. Your code simply checks to see if the current date/time equals the public variable. Something like this:

If (MyPublicVariable >= Now) then
MyPublicVariable = 0
email...
End If
 
im using dlookup on timer on a hidden form. if the time field im looking up is equal to the current time i want it then to send an email. it works for looking up the date but not for time?
 
Sorry, I'm pretty busy and in my haste didn't see some of your code. I understand what you're doing. I would still do what I recommend one date/time field rather than a date field and a time field. But, with that said, you might try using debug to determine what exactly is going on in your code. Do you know how to use debug? If not, I can get your started really easy.
 
i originally set out using a date/time field but i found alot of my searches require the date field without the time.

no i havnt had that much experience using the debug, how could i use this to help?
 
To use debug. Place the word Stop right before the line of code that you want to examine (or press F9 to toggle the break point on/off on the line of code you want to examine). Then execute your code. The program will pause execution when it encounters Stop or a breakpoint. Either place the mouse pointer over the variable you want to examine (a tooltip will show its value) or open Debug's Immediate Window. In Debug's Immediate Window, type ?yourVariableName to examine its value. Press F8 to step thru your code 1 line at a time. Pressing F5 will continue execution until the program encounters Stop or another breakpoint or reaches the end of your code.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top