Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Look at the spreadsheet you posted.



    The NameID field in the spreadsheet is a name string, not a numeric ID.

    I did the date edit in the spreadsheet before importing to Access table. Since the Dates field in your Access table is a date datatype, the '-' character may be a format setting for display purposes and not actually in the date value. Format settings in table can carry over into queries. However, I thought this should still work in the query if your criteria follow the same structure but maybe not so for date values. Check the Format property for the Dates field in the table, remove anything there and view the field without formatting. What does the data look like?

    I never set formatting or Lookups in tables just to avoid this sort of confusion.
    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.

  2. #17
    hawkins is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    82
    sweet got it to work thanks! I was wondering though, if I plug in exactly what you gave me it works but say I plug in, different range and date value:
    SELECT * FROM Example
    WHERE Dates Between #3/1/2009# And #5/30/2009# And Dates=Nz(DMin("Dates","Example","Month(Dates)=5 AND NameID='" & [NameID] & "'"),DMin("Dates","Example","NameID='" & [NameID] & "'"));

    or even Month(Dates)=4, I only get that month back but yours gives me the correct value. I just dont understand why when I change those 2 things it causes it to not work.

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Sorry, I should have done more testing. Will have to put the date range in both of the DMin terms. Change the WHERE part to:

    WHERE Nz(DMin("Dates","Example","Dates Between #3/1/2009# And #5/31/2009# And Month(Dates)=5 AND NameID='" & [NameID] & "'"),DMin("Dates","Example","Dates Between #3/1/2009# And #5/31/2009# And NameID='" & [NameID] & "'"))

    Note that March, May, July, August, October, December have 31 days, not 30 and then there is February.
    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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2011, 11:00 AM
  2. Querying the "minimum value" record
    By LunaticFringe82 in forum Queries
    Replies: 1
    Last Post: 06-02-2011, 04:10 PM
  3. Search By Criteria - Flexible Criteria Fields
    By lilanngel in forum Access
    Replies: 0
    Last Post: 03-16-2011, 06:25 PM
  4. one-to-many-or-none table relationship? (minimum cardinality)
    By racecar333 in forum Database Design
    Replies: 2
    Last Post: 02-24-2011, 07:11 AM
  5. Can't see minimum or maximum buttons?!?
    By Felix_too in forum Forms
    Replies: 2
    Last Post: 12-29-2010, 10:04 AM

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