Iif query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NCRStinks
    New Member
    • Jul 2007
    • 45

    #16
    Originally posted by FishVal
    Hi, Dan.

    Try this modified code. Note, comparisson operators changed in line#12.

    Code:
    Private Function ValidateTimeSlot() As Variant
        
        With Me
            If IsNull(.StartTime) Or IsNull(.EndTime) Or _
                IsNull(.Stylist) Or IsNull(.[Appt Date]) Then
                ValidateTimeSlot = Null
                Exit Function
            End If
            If DCount("ID", "[Your table name]", _
                "((StartTime>#" & .StartTime & "# And StartTime<#" & .EndTime & _
                "#) Or (EndTime>#" & .StartTime & "# And EndTime<#" & .EndTime & _
                "#) Or (StartTime<=#" & .StartTime & "# And EndTime=>#" & .EndTime & _
                "#)) AND Stylist=" & .Stylist & _
                " AND [Appt Date] = #" & .[Appt Date] & "#")<>0 Then
                MsgBox ("time interval bla bla bla")
                ValidateTimeSlot = False
            Else
                ValidateTimeSlot = True
            End If
        End With
        
    End Function
    Thanks FishVal!

    Its working great now! Thanks ever so much for your help!

    Thanks

    Dan

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #17
      You are welcome, Dan.

      Good luck.

      Comment

      Working...