Results 1 to 2 of 2
  1. #1
    brpathirana is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2012
    Posts
    4

    Generate an AutoNumber for falling under two different categories

    I am creating a database relates to hospital medical equipment using Access 2003. Using VBA code, I want to generate an AutoNumber for each Equipment falling under different Equipment and different Hospital.

    Ex: DGG-ECG-001
    DGG-ECG-002
    DGG-XRY-001


    WBH-ECG-001
    WBH-XRY-001
    WBH-XRY-002 and so on…..

    Where DGG & WBH are Hospital Codes (PK in tblHospitalCodes) ; ECG & XRY are Equipment Codes (PK in tblEquipmentCodes) ; last 3 digit denotes the AutoNumber.
    Both the Hospital & the Equipment select using combo box then generates the AutoNumber Using command Button.

    I am new to Access and VBA and much appreciate if someone can help me.

    Thanks
    Buddhika

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You can't have an "Autonumber" like you want. You can use an autonumber AND have a "Custom Number" field. In your case, you would need three fields: 1 for the Hospital Codes, 1 for the Equipment Codes and 1 for the sequence number (not autonumber).

    This should help: http://www.baldyweb.com/CustomAutonumber.htm

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

Similar Threads

  1. Replies: 3
    Last Post: 06-09-2012, 09:49 PM
  2. Replies: 1
    Last Post: 05-01-2012, 03:52 AM
  3. Holidays falling between dates
    By Alex Motilal in forum Queries
    Replies: 1
    Last Post: 11-15-2010, 11:59 PM
  4. Replies: 3
    Last Post: 08-29-2010, 06:34 AM
  5. Combo Box sub categories
    By workindan in forum Access
    Replies: 1
    Last Post: 06-17-2010, 09:18 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