BETWEEN from hours

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

BETWEEN from hours

Post by sal21 »

Ho to use a between sql from 2 hours?

Attached my property filed.

In field ORA have:

11:20
15:17
...
12:26

i use Access database
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78475
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: BETWEEN from hours

Post by HansV »

You can use (for example)

SELECT ... FROM ... WHERE ORA_OP Between #05:00# And #14:00#
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: BETWEEN from hours

Post by sal21 »

HansV wrote:You can use (for example)

SELECT ... FROM ... WHERE ORA_OP Between #05:00# And #14:00#
WOW! :thankyou:

about this post....

i have a var MyVar=7 (is the initial hour of list)

i need to fill a combobox3 with hours and half hour from MyVar =7 to 24 with a step of half hour in this format HH:MM

similar:
07:00
07:30
08:00
08:30
...
24:00

MyVar is variable and it can assume only a fied hour 7 or 8 or 9...ecc

my test code, but not work:-(

Code: Select all

 Dim INIZIO As String
    INIZIO = 7
    With Me.Combo3
    For I = 0 To 24
    INIZIO = INIZIO + 30
    Me.Combo3.AddItem Format$(INIZIO, "HH:MM")
    DoEvents
    Next I
    End With

User avatar
HansV
Administrator
Posts: 78475
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: BETWEEN from hours

Post by HansV »

Try this:

Code: Select all

    Dim i As Long
    For i = 2 * MyVar To 48
        Me.Combo3.AddItem Format(i / 48, "hh:mm")
    Next i
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: BETWEEN from hours

Post by sal21 »

HansV wrote:You can use (for example)

SELECT ... FROM ... WHERE ORA_OP Between #05:00# And #14:00#
sorry me... but
If the two var INIZIO & FINE are = blank wath range of hours get the sql?

User avatar
HansV
Administrator
Posts: 78475
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: BETWEEN from hours

Post by HansV »

You'll get an error message.
Best wishes,
Hans