Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date/Time error in query (2003)

    Hello everyone,

    I am using a query to identify records with changes between two table, one is my source table one is the master when I download new source data I run this query to identify those records with changes to them. The source table has two fields (date and another call time) in the master I have merged these fields to be Arrival.

    The format of the date/time field in the master table is dd/mm/yyyy hh/mm/ss its appears that if the time is 00:00:00 the arrival time gets changed to display just the date (no time) this causes a problem with my query as it is looking for a change in either the date or the time fields and thinks there is a change in the time.

    Here the criteria in my query. The field in the query is called Arrival and is in the master table (TblMaster)

    Not Like [TblAEPASDataFormatted].[ArrivalDate] & " " & [TblAEPASDataFormatted].[ArrivalTime] And Between [Forms]![FrmMainMenu]![SubForm]![txtsd] & " " & "00:00:00" And [Forms]![FrmMainMenu]![SubForm]![txted] & " " & "23:59:59"

    My question is what is the correct way to achieve this or is there some kind of work around

    Many thanks
    Regards
    Gerbil (AKA Kevin)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date/Time error in query (2003)

    Are ArrivalDate and ArrivalTime date/time fields, or are they text fields?

  3. #3
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date/Time error in query (2003)

    Hi Hans,

    They ae both Time/Date fields
    Regards
    Gerbil (AKA Kevin)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date/Time error in query (2003)

    You should calculate the Arrival field by adding the date and time, not by concatenating them. Arrival will then be a date/time field too, instead of a text field.

  5. #5
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date/Time error in query (2003)

    Thanks Hans,

    Do you mean replace
    [fielda] & " " & [fieldb]
    with
    [fielda] + [fieldb]

    Thanks
    Regards
    Gerbil (AKA Kevin)

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date/Time error in query (2003)

    Yes, indeed.

    Alternatively, you could keep the fields separate, and compare the date fields and time fields.

  7. #7
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date/Time error in query (2003)

    Wish I had kept them seperate now, but unfortunatly I am to far into the build now.

    Thanks Hans
    Regards
    Gerbil (AKA Kevin)

Posting Permissions

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