PC Review


Reply
Thread Tools Rate Thread

Stop macro when time is <xx:xx

 
 
Siritl via AccessMonster.com
Guest
Posts: n/a
 
      1st Aug 2007
I have a macro that loops 3 forms in Access. I would like to write a code
preferabelly in VB that stops these macros when time reaches 18.00. I have
tried something like this, but it seems like Access ignores the code:

Private Sub Skjema1_BeforeUpdate(Cancel As Integer)

If Time <= "18:00" Then
Run macro

Else
Close Form

End If

End Sub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200708/1

 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      1st Aug 2007
IF Time() <= #18:00:00# THEN

Dates and times are delimited using # marks not " marks.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Siritl via AccessMonster.com" <u35179@uwe> wrote in message
news:760a4b766468a@uwe...
>I have a macro that loops 3 forms in Access. I would like to write a code
> preferabelly in VB that stops these macros when time reaches 18.00. I have
> tried something like this, but it seems like Access ignores the code:
>
> Private Sub Skjema1_BeforeUpdate(Cancel As Integer)
>
> If Time <= "18:00" Then
> Run macro
>
> Else
> Close Form
>
> End If
>
> End Sub
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200708/1
>



 
Reply With Quote
 
Siritl via AccessMonster.com
Guest
Posts: n/a
 
      1st Aug 2007
Ok, thank you!
But the code still doesn't work. Do you know what I can write to stop the
macro from running?

John Spencer wrote:
>IF Time() <= #18:00:00# THEN
>
>Dates and times are delimited using # marks not " marks.
>>I have a macro that loops 3 forms in Access. I would like to write a code
>> preferabelly in VB that stops these macros when time reaches 18.00. I have

>[quoted text clipped - 11 lines]
>>
>> End Sub


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200708/1

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      1st Aug 2007
If you are executing the macro from some other place than this code snippet,
you will have to modify the macro. Since I almost never do a macro I have
no idea how you could do that.

In the macro you should be able to use a condition to run or not run a macro

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Siritl via AccessMonster.com" <u35179@uwe> wrote in message
news:760ab00d1acbd@uwe...
> Ok, thank you!
> But the code still doesn't work. Do you know what I can write to stop the
> macro from running?
>
> John Spencer wrote:
>>IF Time() <= #18:00:00# THEN
>>
>>Dates and times are delimited using # marks not " marks.
>>>I have a macro that loops 3 forms in Access. I would like to write a code
>>> preferabelly in VB that stops these macros when time reaches 18.00. I
>>> have

>>[quoted text clipped - 11 lines]
>>>
>>> End Sub

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200708/1
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
First Time Macro User--Stop Recording Toolbar tanzi2@verizon.net Microsoft Excel Misc 1 16th Nov 2007 11:44 PM
Start/Repeat/Stop Macro at specific time/interval =?Utf-8?B?YW5keQ==?= Microsoft Excel Programming 10 30th Aug 2007 02:38 AM
How can I stop Outlook from showing 'end' time in Monthly view? & how can I stop it from trimming the appointment titles...? ship Microsoft Outlook Discussion 2 20th Jan 2007 03:54 AM
How can I stop Outlook from showing 'end' time in Monthly view? & how can I stop it from trimming the appointment titles...? ship Microsoft Outlook 2 20th Jan 2007 03:54 AM
Start Macro / Stop Macro / Restart Macro Pete Microsoft Excel Programming 2 21st Nov 2003 06:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:02 PM.