Please Help!!! Is 864,000,000 right!!

DaniBoy

Registered User.
Local time
Today, 01:44
Joined
Nov 18, 2001
Messages
174
Hello, well am still trying to get this "on timer: code to work, I have tried two ways :!!

#1) I used this code:

Private Sub Form_Timer()
If Format(Time(), "hh nn ss") = "03,05,00" Then
MsgBox "It Works!!!"
End If
End Sub

I dont know if the format is bad!! But it does nothing

#2)

Private Sub Form_Timer()
If Time > TimeSerial(3, 28, 0) Then
MsgBox "It Works!!!"
End If
End Sub

with time interval = 5000

it works, But it does it before the time 3:05:00 pm and if I change it to "< then" it never does it when it changes when it changes to the right time or more. Plus every 5 seconds it repeats it.

How do I make it so it only do it once a day? Do I have to put an interval of 864,000,000? seems wrong!!

What is wrong with the first code?

Thank you

Daniboy :confused: :mad: :confused:
This are the links where I got the codes!!

http://www.access-programmers.co.uk...ort+timer+event

http://www.access-programmers.co.uk...ort+timer+event
 
Last edited:
If you set the timer interval for 1000, it will run the timerevent every second. I have tested this, so I know it works.

If Format(Now(), "hh:mm:ss") = "15:47:00" Then
MsgBox "It Works!"
End If


This will pop up a message box at exactly 3:47 pm (15:47:00) You need to add 12 hours to the time if you are referring to pm. And the message will only appear once a day, because the time I entered only occurs once in a 24 hour period.
 
It Works Great!!! Now, I need to...

Thanks for the help!!,

I replaced the msgbox with the code to send a report via email and it works good. Now I need to know if the following is posible. Can I make it so the email program DOES NOT appear or open up when the email needs to be sent? Can it send it automaticly, without the user having to do anything?

Thanks
DaniBoy
 
If you are using the SendObject method to send an email, change the last parameter value of true to false. This parameter value is for EditMessage. If it is set to true, you're procedure is not going to autosend the message, but will wait for the user to edit the message before sending. By setting it to false, you are indicating the you don't want the user to edit the message before sending.
 
Thank you so much!!

I will try that and test it, thank you for responding so fast!!

DaniBoy
 
It Works Great!!! Now, I need to...

I there any other way other than a form to make the "On Timer" event work? What I want to do is to make the "On Timer" code run without having the form open. Maybe put it on a autoexec that starts running the code when I open the database.

Any ideas on how I can do this? Remember I want to run a timer code.

Thank you

DaniBoy
 
You need the timer control to make the code work. This can be accomplished by either using the timer event of a form (any form) or adding a timer control to a form (any form). But from my understanding and experience, you need some sort of form to open to run the timer. You can always set the form with the timer code as the startup form (same principle as the autoexec macro), but you will need to ensure that the form can't be closed by the user.

What exactly are you trying to do?
 
I'm trying to have the application send an email every day at 12:55 am and 4:50 pm. I wanted to do this by just having the application open instead of the form. This way the user can continue working on the other data entry forms and the email would be sent automaticaly.

If this cant be, I think I could use a form that is minimized and always there when the application is running. I tried it and the form does not have to have the focus, it just needs to be open.

You have been great helping me with this issue, I realy appritiate it.

My boss is gonna freak!!!! jejeje.

Thanks
DaniBoy
 
There might be another way.

Windows has something called a Task Scheduler. If no other place, it is under Accessories >> System tools. But it might also be in other places. You can run a specific application with it.

If you can build a macro that does what you want done, you can put a reference in the task scheduler that opens the database, runs a macro, and then exits. No forms need to be open until the critical moment. No NOTHING needs to be running - except Windows itself.

The way this task scheduler works is, you run Access on the specific database. Create an icon that opens the specific database when you double-click it. Do an "Add" within the scheduler to get into the task-adding wizard. Now select the database icon you just created. Schedule it according to your needs.

Next, get into the icon to edit its properties. Add the /X switch-option at the end of the rest of the line to execute your macro. ( ... /X macro-name ) The macro you create has to end with the Quit command, which will close Access for you.

The Windows task scheduler can very easily be made to run something once per day at a specific time. This is a case where you don't need to re-invent the timer wheel because Windows has done that for you.

By the way, this even lets you run the same task on multiple days or the same task at multiple times during the same day. This is because the Windows task manager supports that possibility. You don't have to program Access to do it for you.
 

Users who are viewing this thread

Back
Top Bottom