Results 1 to 7 of 7
  1. #1
    cplmckenzie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    25

    Use Partial field value as criteria

    Hello,



    I have a quick question.

    In a table I have a record field named TransDate , type is short text, format is mm/dd/yr.

    Can I possible use the mm part of the field and use it as the criteria in the Query Builder "Criteria" section.

    cplmckenzie

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Access has a Date/Time datatype specifically for Dates.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    Not against the full date value. Dates are actually stored as a number, even though you see default formatting of 12/31/2014, the actual value is 42004.

    Create a field in query with expression that extracts the month and apply filter criteria to that field. Same if you need to also filter by year.
    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.

  4. #4
    Farida is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    19
    Easy option to extract month and years from dates are
    month(TransDate)
    year(TransDate)

    And this can be used in criterias in your queries. Hope this helps.

  5. #5
    cplmckenzie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    25
    Hello,

    I attempted using the option that you suggested Farida in the following SELECT WHERE.....

    SELECT [2014ExpenseList].[TransDate], [2014ExpenseList].[TransType], [2014ExpenseList].[TransCategory], [2014ExpenseList].[TransPayee], [2014ExpenseList].[TransCostCtr], [2014ExpenseList].[TransAmount] FROM 2014ExpenseList
    WHERE [2014ExpenseList].[month(TransDate)] = txtMonth.value;

    But access displayed an input box requesting the month(TransDate) parameter.

    June7, could you give me a bit more detail on your suggestion that I may try it also.

    cplmckenzie

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    My suggestion is the same as Farida's. Just need to adjust your WHERE clause.


    WHERE Month([TransDate]) = [enter month number];

    or

    WHERE Month([TransDate]) = Forms!formname.txtMonth;
    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.

  7. #7
    cplmckenzie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    25
    Farida - June7,

    Thanks to both of you. Problem solved!!!!

    cplmckenzie

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

Similar Threads

  1. Partial Match Query
    By punna111 in forum Queries
    Replies: 10
    Last Post: 08-20-2014, 03:35 PM
  2. partial display
    By tawright in forum Access
    Replies: 2
    Last Post: 07-20-2011, 09:38 AM
  3. Extract Partial Data
    By madsc1 in forum Access
    Replies: 6
    Last Post: 03-16-2011, 03:43 PM
  4. Partial Limit
    By bglaugh in forum Programming
    Replies: 1
    Last Post: 09-15-2010, 06:49 AM
  5. Replies: 1
    Last Post: 03-22-2010, 03:37 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