Results 1 to 5 of 5
  1. #1
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29

    Criteria based on user input

    I have a Time sheet query with a field "Date" and a field "Time" the criteria for the "Date" is based on a user input as follows.



    >=[Start date] And <=[End date]

    Now I'm trying to set a criteria on the "Time" field to only return the records where the time is > 17:00:00 if the "Date" < then the [End date].

    The problem I have is how to refer to the user input [End date] criteria from the "Date" field.

    Hopefully this makes sence.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Date is a reserved word in Access/VBA. Should not use reserved words as field names.

    Is the Time field a date/time data type?

    I never use dynamic parameter input popups. Cannot validate user input.

    Review http://www.allenbrowne.com/ser-62.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Note that "Time" is also a reserved word......

  4. #4
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29
    Probably a bad example using Time and Date in my question.
    In my original Query the fields are called TimeSheetDate, StartTime and EndTime, all Date/Time type fields.

    I'm using the user input just to select which time sheets to print, based on the date ( [start date] and [end date] ).
    But I would like to set a criteria on the StartTime >=13:00:00 for all the dates < [End date]

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I've never needed to filter records by a time value. From the few times I've helped someone with that, I found it to be tricky.

    I don't understand why the time is relevant to printing a timesheet. Shouldn't this be by pay period?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 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. Replies: 1
    Last Post: 11-04-2014, 12:07 PM
  2. Criteria based on user input
    By Alsail77 in forum Queries
    Replies: 5
    Last Post: 08-16-2012, 02:19 PM
  3. Selecting records based on criteria from user input
    By shabbaranks in forum Programming
    Replies: 1
    Last Post: 01-04-2012, 09:06 AM
  4. Criteria issue when using user input and > < ect
    By scotty562 in forum Queries
    Replies: 3
    Last Post: 11-11-2010, 11:08 AM
  5. Replies: 6
    Last Post: 07-22-2010, 05:53 PM

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