Results 1 to 10 of 10
  1. #1
    Rick5150 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    16

    AutoNumber Question


    Is is possible to have a formatted autonumber field that can be edited?

    I am tracking jackets, and the format of the current design is LLLL-NNNN where L is the prefix letters and N is the auto number.

    However, if the style is simply a slight variation of the original pattern, we designate this by adding a lower case suffix.

    So if the original pattern was ABCD-0123, the 1st variation of the design would be ABCD-0123a, and the second would be ABCD-0123b, etc.

    I am afraid I will have to enter this all manually as there is not a way to overwrite an auto field.

    Any suggestions?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  3. #3
    Rick5150 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    16
    Too confusing for me, sorry. Let's stay with a standard 8-digit number.

    Table is named "Customers"
    Field is named "Customer #"

    There are some lengthy expressions, but I cannot understand them. I did try this one, but it does not work:

    Private Sub Form_BeforeInsert(Cancel As Integer)
    Customer_# = Nz(DMax("Customer_#", "Customers")) + 1
    End Sub

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You could eliminate some of your problems by not using any special characters in names: http://support.microsoft.com/?id=826763

  5. #5
    Rick5150 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    16
    Thank you. I have since removed all special characters and separated all blank spaces with underscores.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you get your DMax() to work?

  7. #7
    Rick5150 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    16
    No. I had no luck whatsoever getting the numbering to work.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What do you now have for this:
    Customer_# = Nz(DMax("Customer_#", "Customers")) + 1

  9. #9
    Rick5150 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2011
    Posts
    16
    Customer_No = Nz(DMax("Customer_No", "Customers")) + 1

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you single stepped or put a diagnostic MsgBox in it to see what is returned?

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

Similar Threads

  1. Help with autonumber
    By GDubbs780 in forum Programming
    Replies: 15
    Last Post: 02-27-2011, 02:27 PM
  2. Autonumber with Text
    By jgelpi16 in forum Access
    Replies: 6
    Last Post: 01-21-2011, 02:36 PM
  3. AutoNumber Info
    By anoob in forum Access
    Replies: 3
    Last Post: 01-12-2011, 05:35 PM
  4. Complex VBA Autonumber question
    By Lockrin in forum Access
    Replies: 2
    Last Post: 04-13-2010, 01:25 PM
  5. AUTONUMBER
    By J A F F A in forum Database Design
    Replies: 1
    Last Post: 10-03-2007, 10:30 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