Results 1 to 6 of 6

Thread: [RESOLVED] trying to check between hours nothing works why?

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] trying to check between hours nothing works why?

    hey,
    i have a waiting list that i add customers there.
    now, in there i add the customer name and the hours that he is free to schedule an appointment.
    when there is a free appointment in my schedule i need to check if there is a customer
    that is waiting between the hours he is free.
    E.X
    salsa can make to the appointment from 11:00 to 12:00

    so if i cancel an appointment in my schedule (that the appointment was in 11:15)
    then i need to check the waiting list to see if there is any customers that is free between these hours.

    i tried to use some code but it dosnt work at all.
    this is the code i am using
    Code:
    If Format(Rs!WaitFromHour, "HH:MM:SS") >= StrTimeStartEvent Or Format(Rs!WaitUntilHour, "HH:MM:SS") <= StrTimeEndEvent Then...'
    tnx for any help
    salsa

  2. #2
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: trying to check between hours nothing works why?

    Hi,

    add Day and Time !! it is a schedule programm

    Code:
    Private Sub Command1_Click()
    Dim d As Date, d1 As Date
       Dim s As String, s1 As String
       Dim sSQL As String
       
          d = CDate("18.07.2018 08:30:00")
          d1 = CDate(Now)
          
          s = Format(d, "\#mm\/dd\/yyyy hh:mm:ss#")
          s1 = Format(d1, "\#mm\/dd\/yyyy hh:mm:ss#")
          
          sSQL = "Select * From Table1 Where Datum Between " & s & " And " & s1 & ";"
          MsgBox sSQL
    End Sub
    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: trying to check between hours nothing works why?

    hey chris
    its not what i need my friend

  4. #4

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: trying to check between hours nothing works why?

    Code:
            Dim DtForWait As Date
            Dim StrTimeStartEvent As Date
            Dim StrTimeEndEvent As Date
            DtForWait = Format(Rs!StartDateTime, "DD/MM/YYYY")
            StrTimeStartEvent = Format(Rs!StartDateTime, "HH:MM")
            StrTimeEndEvent = Format(Rs!EndDateTime, "HH:MM")
    Code:
            Dim StrTimeStrt As Date
            Dim StrTimeEND As Date
            StrTimeStartEvent = Format(Rs!StartDateTime, "HH:MM")
            StrTimeEndEvent = Format(Rs!EndDateTime, "HH:MM")
    Code:
    If DateDiff("n", DtForWait, StrTimeStrt) >= DateDiff("n", DtForWait, StrTimeStartEvent) Or DateDiff("n", DtForWait, StrTimeEND ) <= DateDiff("n", DtForWait, StrTimeEndEvent) Then
    if i cancel an appointment that started from 10:15 until 10:45
    and in the waiting list there is a customer that has free time
    from 10:00 to 11:00 then i need to schedule him

    so i need basicaly to find if the free time of the customer
    is the hours between the canceld appointment (10:15 - 10:45)
    then to schedule him.
    Last edited by salsa31; Jul 18th, 2018 at 06:49 AM.

  5. #5
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    764

    Re: trying to check between hours nothing works why?

    So you need to find any Customer with a free period that completely contains the appointment they you've just cancelled?

    Something like this?

    Code:
    cancelledStart = "10:15" 
    cancelledEnd = "10:45"
    
    select * 
    from freeTime 
    where StartTime <= :cancelledStart 
    and   EndTime   >= :cancelledEndTime
    order by ...
    If that doesn;t do the trick, show us the data you're working with; that's far more important that the code.

    Regards, Phill W.

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: trying to check between hours nothing works why?

    tnx i got it finally

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width