|
|
All,
I am trying to restrict TimeOut field to the times indicated below. Obviously it is not working and I can't see why. The formating on that field is Medium Time.
If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", vbInformation, "AM/PM" Me.txtTimeOut = Null End If Exit Sub
Thanks in Advance! Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II
|
|
Gina Whipp wrote:
[Quoted Text] >I am trying to restrict TimeOut field to the times indicated below. >Obviously it is not working and I can't see why. The formating on that >field is Medium Time. > > If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then > MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", >vbInformation, "AM/PM" > Me.txtTimeOut = Null > End If
Literal date/time value must be enclosed in # signs, not quotes:
If Me.txtTimeOut >= #12:00 AM# And Me.txtTimeOut <= #05:00 AM# Then
-- Marsh MVP [MS Access]
|
|
I hate when the obvious is staring at me... HUGH Thank you!
-- Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II "Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message news:m9udj4ltvk3j2fnqpcsai6ce0tojpie2mf[ at ]4ax.com...
[Quoted Text] > Gina Whipp wrote: >>I am trying to restrict TimeOut field to the times indicated below. >>Obviously it is not working and I can't see why. The formating on that >>field is Medium Time. >> >> If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then >> MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", >>vbInformation, "AM/PM" >> Me.txtTimeOut = Null >> End If > > > Literal date/time value must be enclosed in # signs, not > quotes: > > If Me.txtTimeOut >= #12:00 AM# And Me.txtTimeOut <= #05:00 > AM# Then > > -- > Marsh > MVP [MS Access]
|
|
Marshall,
Can you tell why entering 10:15 AM generates my message?
-- Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II "Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message news:m9udj4ltvk3j2fnqpcsai6ce0tojpie2mf[ at ]4ax.com...
[Quoted Text] > Gina Whipp wrote: >>I am trying to restrict TimeOut field to the times indicated below. >>Obviously it is not working and I can't see why. The formating on that >>field is Medium Time. >> >> If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then >> MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", >>vbInformation, "AM/PM" >> Me.txtTimeOut = Null >> End If > > > Literal date/time value must be enclosed in # signs, not > quotes: > > If Me.txtTimeOut >= #12:00 AM# And Me.txtTimeOut <= #05:00 > AM# Then > > -- > Marsh > MVP [MS Access]
|
|
If you want times to be limited to >= 6 AM use
If Me.txtTimeOut < #06:00:00 AM# Then
"Gina Whipp" wrote:
[Quoted Text] > All, > > I am trying to restrict TimeOut field to the times indicated below. > Obviously it is not working and I can't see why. The formating on that > field is Medium Time. > > If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then > MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", > vbInformation, "AM/PM" > Me.txtTimeOut = Null > End If > Exit Sub > > > Thanks in Advance! > Gina Whipp > > "I feel I have been denied critical, need to know, information!" - Tremors > II > > >
|
|
Thank you! I guess I was over thinking!
-- Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II "Jim Burke in Novi" <JimBurkeinNovi[ at ]discussions.microsoft.com> wrote in message news:31243A28-D335-4770-BF0D-90C6BCF6B432[ at ]microsoft.com...
[Quoted Text] > If you want times to be limited to >= 6 AM use > > If Me.txtTimeOut < #06:00:00 AM# Then > > "Gina Whipp" wrote: > >> All, >> >> I am trying to restrict TimeOut field to the times indicated below. >> Obviously it is not working and I can't see why. The formating on that >> field is Medium Time. >> >> If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then >> MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", >> vbInformation, "AM/PM" >> Me.txtTimeOut = Null >> End If >> Exit Sub >> >> >> Thanks in Advance! >> Gina Whipp >> >> "I feel I have been denied critical, need to know, information!" - >> Tremors >> II >> >> >>
|
|
Gina Whipp wrote:
[Quoted Text] >Can you tell why entering 10:15 AM generates my message?
I can't reproduce that effect.
Are you sure the field (in the table) is a Date type field?
-- Marsh MVP [MS Access]
|
|
I got it thanks... and yes it was a date field.
-- Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II "Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message news:ds3ej41g55sa47kqbddri3ab8s3i60heik[ at ]4ax.com...
[Quoted Text] > Gina Whipp wrote: >>Can you tell why entering 10:15 AM generates my message? > > > I can't reproduce that effect. > > Are you sure the field (in the table) is a Date type field? > > -- > Marsh > MVP [MS Access]
|
|
I hate it when I see 12:00 AM.
Not because I'm picky, just because there is no agreement, and no reference. I have to figure it out every time I see that. One of my Internet Providers has unrestricted Access from 12:00 PM to 12:00 AM. What does that mean? Can you look it up on the Internet? Good luck at that: you have to figure it out.
In this case, I already know how time is represented in Access, so I could just say
If Me.txtTimeOut <= #05:00 AM# Then
Conversely, if I didn't know how time was represented in Access, I would certainly never do time comparisons at all.
(david)
"Gina Whipp" <NotInterested[ at ]InViruses.com> wrote in message news:%23jo6AtYVJHA.5456[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text] > All, > > I am trying to restrict TimeOut field to the times indicated below. > Obviously it is not working and I can't see why. The formating on that > field is Medium Time. > > If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then > MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", > vbInformation, "AM/PM" > Me.txtTimeOut = Null > End If > Exit Sub > > > Thanks in Advance! > Gina Whipp > > "I feel I have been denied critical, need to know, information!" - Tremors > II >
|
|
Thanks for you input but as you can by previous posts this answered...
-- Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II "david" <david[ at ]nospam.au> wrote in message news:O1mK72ZWJHA.4632[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text] >I hate it when I see 12:00 AM. > > Not because I'm picky, just because there is no agreement, and > no reference. I have to figure it out every time I see that. One of > my Internet Providers has unrestricted Access from 12:00 PM to > 12:00 AM. What does that mean? Can you look it up on the > Internet? Good luck at that: you have to figure it out. > > In this case, I already know how time is represented in Access, > so I could just say > > If Me.txtTimeOut <= #05:00 AM# Then > > Conversely, if I didn't know how time was represented in Access, > I would certainly never do time comparisons at all. > > (david) > > > "Gina Whipp" <NotInterested[ at ]InViruses.com> wrote in message > news:%23jo6AtYVJHA.5456[ at ]TK2MSFTNGP05.phx.gbl... >> All, >> >> I am trying to restrict TimeOut field to the times indicated below. >> Obviously it is not working and I can't see why. The formating on that >> field is Medium Time. >> >> If Me.txtTimeOut >= "12:00 AM" And Me.txtTimeOut <= "05:00 AM" Then >> MsgBox "You MUST enter a time between 6:00 am and 11:59 PM!", >> vbInformation, "AM/PM" >> Me.txtTimeOut = Null >> End If >> Exit Sub >> >> >> Thanks in Advance! >> Gina Whipp >> >> "I feel I have been denied critical, need to know, information!" - >> Tremors II >> > >
|
|
|