Results 1 to 3 of 3

Thread: how to disallow identical dates and times?

  1. #1

    Thread Starter
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302

    how to disallow identical dates and times?

    I'm doing this on the fly so your probably gonna have to play with it a little, but try this:

    Code:
    Set rsappointment = dbappointment.Execute("select * from app_date_time") 
    Do Until rsappointment.EOF 
       If rsappointment("app_date") = txtdate.Text And rsappointment("app_time") = txttime.Text Then 
       MsgBox "An appointment is already taken at that time. Please choose another.", , "choose another time" 
            Exit Do
        Else
        rsappointment.MoveNext
        End If
    If rsappointment.EOF Then
      Goto continue
    End IF
    Loop
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  2. #2
    Member
    Join Date
    Apr 2001
    Posts
    44

    Angry how to disallow identical dates and times?

    hello guys! especially babbalouie who has been of a great help
    it's me again with my senior project
    i have a form that contains date and time fields for an appointment.
    i must not allow 2 appointments to be taken the same date at the same time, so i did the following if statement but it is still allowing me to take 2 appointments at the same date and time!
    what should i do? how do i correct it?
    pls help ASAP
    thanks
    terry

    Set rsappointment = dbappointment.Execute("select * from app_date_time")
    Do Until rsappointment.EOF
    If rsappointment("app_date") = txtdate.Text
    And rsappointment("app_time") = txttime.Text Then
    MsgBox "An appointment is already taken at that time. Please choose another.", , "choose another time"
    Exit Sub
    Else: GoTo continue
    End If

    rsappointment.MoveNext
    Loop

  3. #3
    Member 1dumbguy's Avatar
    Join Date
    Oct 1999
    Location
    Rootstown Ohio USA
    Posts
    63
    I'm new at this myself but I'd try

    If rsappointment("app_date")>0 or = txtdate.Text
    And rsappointment("app_time")>0 or = txttime.Text Then

    Just to give the argument that the date/time slot may be taken.


    If a man talks to himself , And his wife doesn't hear him. Is he still wrong ?

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