Syntax for code (1 Viewer)

spacepro

Registered User.
Local time
Today, 06:38
Joined
Jan 13, 2003
Messages
715
Hi All,

I'm very tired and this is probably stating the obvious but I want to assign a value if the time is between 6am and 2pm. What is the syntax in VBA?
Code:
if time = >#06:00# or <#14:00# Then
'assign value here
end if

Not quite there. Anyone help, gone a bit rusty.

Thanks

Andy
 

namliam

The Mailman - AWF VIP
Local time
Today, 07:38
Joined
Aug 11, 2003
Messages
11,695
How about:

if time = >#06:00# and Time <#14:00# Then
'assign value here
end if

Greetz
 

Mile-O

Back once again...
Local time
Today, 06:38
Joined
Dec 10, 2002
Messages
11,316
Is there a date as part of this field?
 

namliam

The Mailman - AWF VIP
Local time
Today, 07:38
Joined
Aug 11, 2003
Messages
11,695
I assumed he was using the Access function Time....
 

Mile-O

Back once again...
Local time
Today, 06:38
Joined
Dec 10, 2002
Messages
11,316
You both have your mathematical operators wrong:

Greater than or equal to is >= and not =>

Code:
if time >= #06:00:00# and Time < #14:00:00# Then
    'assign value here
end if
 

spacepro

Registered User.
Local time
Today, 06:38
Joined
Jan 13, 2003
Messages
715
Thanks namliam,

I knew it was something like that :D

Yes I am using the time function.


The artist formerly known as Mile-O,
I know it was 1am when I wrote the post.

Thanks

Andy
 

namliam

The Mailman - AWF VIP
Local time
Today, 07:38
Joined
Aug 11, 2003
Messages
11,695
SJ McAbney said:
You both have your mathematical operators wrong:

Greater than or equal to is >= and not =>
I just took his example, didnt look at much else...
 

Users who are viewing this thread

Top Bottom