Results 1 to 6 of 6
  1. #1
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200

    DMax with LIKE in criteria


    Hello,

    I have the following DMax function and I want to use LIKE criteria in the criteria portion of the function. Specifically I want to return the max project number of all project numbers that begin with '2013'. The following function isn't working though.

    Code:
    DMax("ProjectNumber", "Projects","ProjectNumber like '2013%'")

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Never tried it, but likely the wildcard would need to be *. Try:


    DMax("ProjectNumber", "Projects","ProjectNumber like '2013*'")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    That didn't work. It works if I eliminate any wildcard characters and actually use the entire value, but I'm wanting to use a 'begins with' filter in the criteria portion of the DMax function.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I set up a brief test and this worked as expected:

    Dmax("textfield","tblData","textfield like '2013*'")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200
    I think I left some extra brackets in my code by mistake because that worked! Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DMAX in VBA
    By Meanfish in forum Access
    Replies: 1
    Last Post: 11-03-2012, 11:06 AM
  2. Replies: 6
    Last Post: 07-24-2012, 03:02 PM
  3. How to use DMAX
    By tomneedshelp in forum Access
    Replies: 2
    Last Post: 03-01-2012, 07:22 AM
  4. Using Nz and Dmax
    By timmy in forum Programming
    Replies: 5
    Last Post: 07-04-2011, 06:42 AM
  5. DMax Condition
    By Luis Ferreira in forum Forms
    Replies: 3
    Last Post: 11-05-2010, 09:48 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