Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24
    I must be missing something. I have tried all of the following syntax and all i get is a "0".

    Nz(DMax("fieldname"),0)+1


    Nz(DMax(Comp#),0)+1

    Nz(DMax("Comp#"),0)+1

  2. #17
    mike60smart is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    263
    Hi

    Can you upload a zipped copy of the database?

  3. #18
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24
    I appreciate your offer. Really do. But I hope to make this a publishable for sale project. If I can get my old head around it. So I'd prefer not to. I trust you understand.

  4. #19
    mike60smart is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    263
    Hi

    OK No probs

    The code has to go in the Before Update of the Form


    Me.InvoiceNr = Nz(DMax("InvoiceNr","tblCustomerOrderdates"),0) + 1

    I am assuming that the Form is based on "tblCustomerOrderdates" which contains a field named "InvoiceNr"

    When you apply the above code you would need to replace InvoiceNr with your Fieldname and replace tblCustomerOrderDates with the name of your Table.

  5. #20
    kd2017 is online now Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    498
    Quote Originally Posted by mike60smart View Post
    Hi kd2017

    I note your comment regarding deleting the Autonumber Primary Key that is always presented when creating a New Table.

    Why would you want to delete this??

    Quite a lot of developers would disagree with this suggestion.
    They're not deleting the primary key, just changing it from autonumber to non autonumber. But I did note my objection to the whole idea earlier.

  6. #21
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24

    Custom Auto Increment

    Uncharted water.
    Attached Files Attached Files

  7. #22
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24
    I was trying to attach to Mike. ?? I have highlighted the field in yellow. I also need to fix that field so it is un-editable. Additionally, I would like to start it at 2001. If that is possible? Thanks Ya'll for watching over an old man. I have take collage courses 3 years ago. But one needs to keep developing to remember.

  8. #23
    mike60smart is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    263
    Hi Rick

    See the attached
    Attached Files Attached Files

  9. #24
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24
    Thanks Mike IT WORKS!. The only thing is I can't find where your Syntax is to see how you did it?

  10. #25
    mike60smart is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    263
    Hi Rick

    If you go into the Design of the Form and then follow the steps in the attached:
    Attached Thumbnails Attached Thumbnails VB.jpg  

  11. #26
    RustyRick is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    NW Alberta
    Posts
    24
    Da Da - Great Thanks VB is over my pay grade

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

Similar Threads

  1. ID autonumber or incremental number in VBA
    By MadTom in forum Database Design
    Replies: 3
    Last Post: 12-02-2019, 04:45 PM
  2. Replies: 6
    Last Post: 09-17-2017, 07:20 PM
  3. Replies: 3
    Last Post: 06-08-2017, 08:03 PM
  4. Replies: 11
    Last Post: 11-11-2014, 06:04 PM
  5. Incremental Number in a Query
    By jmauldin01 in forum Access
    Replies: 5
    Last Post: 01-01-2014, 01:23 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
  •  
Tech Forums: Microsoft Office Forums