Results 1 to 3 of 3

Thread: Filtering Access date/time with VB date in SQL

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Auckland, New Zealand
    Posts
    5

    Question

    Hi all

    I'm trying to select specific data from an Access database but I'm having trouble when using the Access 'date\time' type with the 'date' type in SQL.

    This is my code below. FlightDate and FlightTime are VB Date types, Bookings.Date and FlightNumbers.Departure are Date/Time type.

    AND (Bookings.Date = '""# & FlightDate & #""')
    AND (Flight Numbers.Departure Time = '" & FlightTime & "' );

    The error I receive is "Data type mismatch in criteria expression"

    Can anyone help me? Pleeeease....

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Question

    Hi Romper. I might be wrong but I think your problem is that you have got the date inclosed in Single pips and the # sign, try just using the # sign instead.

    "AND (Bookings.Date = '"# & FlightDate & "#)" & _
    " AND (Flight Numbers.Departure Time = " & FlightTime & ")"

    Hope This Helps

    Ian

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Junior Member
    Join Date
    Mar 2000
    Posts
    29
    I think you also have to use the format mm/dd/yy, it will not except European dd/mm/yy or any other format.

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