Results 1 to 3 of 3
  1. #1
    rshaw63 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    32

    Query Question

    Happy New Year everyone



    I am working on a Query that matches the project name and then returns the next number in another field for numbering purposes
    Click image for larger version. 

Name:	Capture.PNG 
Views:	23 
Size:	5.3 KB 
ID:	43859Click image for larger version. 

Name:	Capture2.PNG 
Views:	23 
Size:	10.6 KB 
ID:	43860Click image for larger version. 

Name:	Capture3.PNG 
Views:	23 
Size:	12.0 KB 
ID:	43861

    on the report i made a text box with the following as a control =IIf([ProjectName]=[ProjectName],DMax("RFI_Number","RFI")+1,Null)

    the result of the query as is gives me the max value of the table for all projects not the one i am searching. Can someone help me figure this problem out. I think i am close

    Click image for larger version. 

Name:	Captur4.PNG 
Views:	23 
Size:	23.3 KB 
ID:	43862
    currently all items in table so the query is going to have to match the project name and then return the MAx value of that project

    Update : all though looking at the above the next available number for both would be correct however i just entered another one today that was number 3 on the table and it still said 4 was the next available but there was already a # 3 for a different project. I hope this is doable.

    thanks everyone in advance for your help.
    Last edited by rshaw63; 01-05-2021 at 08:54 PM. Reason: Additional Information

  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
    I'm not sure I understand what you're asking, but with no criteria the DMax() will return the largest value in the table regardless of project. Perhaps you need a criteria:

    http://www.theaccessweb.com/general/gen0018.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Maybe change the formula on the report to:
    =DMax("RFI_Number","RFI","[ProjectName]='" &[ProjectName] & "'")+1
    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 1
    Last Post: 05-17-2017, 01:21 AM
  2. Replies: 1
    Last Post: 03-05-2016, 05:22 AM
  3. Query question
    By Accessbegin in forum Queries
    Replies: 3
    Last Post: 11-27-2015, 10:47 AM
  4. Query question
    By T_Tronix in forum Access
    Replies: 8
    Last Post: 11-12-2013, 11:35 AM
  5. Sub-query question
    By hklein in forum Queries
    Replies: 1
    Last Post: 05-01-2012, 03:02 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