Results 1 to 2 of 2
  1. #1
    fm290 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012

    Question Compare current time with Time() function in access

    Actually I'm very new in Microsoft access 2010. i have one software which communicating with the Microsoft Access. it just send one line of command to ms access and access will execute. for example for comparison of date I'm using below command:
     Arrival_Date like Date()
    the ms access execute this command properly and it compare the Arrival_Date with the current date. the Arrival_Date value format for example is 10/8/2012.
    now i want to compare the current time which is return form Time() function with the Arrival_time. the Arrival_Time value format for example is 5:11:00 PM.
    i want to check whether the current time is within the Arrival_Time - 30second and Arrival_Time + 30second.
    I have used :
    WHERE Arrival_Time BETWEEN Dateadd("s",-30,Time()) AND Dateadd("s",30,Time())
    But does not work.

    what command should i use to do this comparison in ms access.
    appreciate your consideration.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    Include date part in the comparison. Any date will work.

    WHERE CDate("1/1/2000 " & Arrival_Time) BETWEEN CDate(DateAdd("s",-30,"1/1/2000 " & Time())) AND CDate(DateAdd("s",30,"1/1/2000 " & Time()))
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Show current Time
    By dada in forum Programming
    Replies: 5
    Last Post: 05-03-2012, 04:32 AM
  2. Replies: 1
    Last Post: 02-28-2012, 09:16 PM
  3. How to show current vacation time
    By Brian62 in forum Forms
    Replies: 1
    Last Post: 06-24-2011, 04:34 PM
  4. Replies: 2
    Last Post: 12-23-2010, 09:11 AM
  5. VB coding to show current date n time in access form
    By cwwaicw311 in forum Programming
    Replies: 6
    Last Post: 02-10-2010, 09:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums