Results 1 to 5 of 5
  1. #1
    ThornofSouls's Avatar
    ThornofSouls is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Sweden, Gothenburg
    Posts
    42

    Question How to create a incrementing text field tied to multiple tables?

    Hello everyone!

    I have a question for you guys.

    This is a errand database where each client can have several errands and some errands are related to each one and other.


    This is how i have thought about it.
    Since each client can have several errands and and each errand is related to each one and other, then the client. I thought i need key which can work as a ClientErrandID, so i can tie the errands together. My idee is to use the ClientErrandID as an text auto incrementing field with a string like: (Errand-A-xxxx).
    Lest say the range would be from (Errand-A-0000 to Errand-A-9999) And when the string hits "9999" at the end the "A" will switch to a "B" and the number counter would start over from "0000"


    • How should the table relationship look like?
    • When a user is adding a new errand to a client, how should the function work?


      • Should all the associated errands be created in the background and granted the same Errand_ID when the main errand is created?

    • Can i create a incrementing text field with vba & queries?
      • How would the code structure look like?
      • Is there any examples on a incrementing text field with code available?


    If you feel like i missed something, let me know and i add it

    //ThornofSouls

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I think you are putting too much effort into ClientErrandID . Just set it to autonumber and be done. Theres no need to do Errand-A, Errand-B.
    The system uses the key, it doesnt care. Humans dont need to know the key or see it, so the ERRAND-A is just more work youd have to do to get it right.
    You would associate like Errands in a form and the keys would join in the background. (master-child forms)
    no muss, no fuss.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Thorn,
    Access doesn't need the codification eg Errand-A-xxxx.
    Access only requires a unique identifier for each record in the table.

    I'm in agreement with ranman -- too much emphasis on ClientErrandID
    You really need to focus on the "things" involved in your "business" and get all the relevant facts recorded and clarified. Then start to design the database. Too many people jump in trying to work with HOW before they understand WHAT. The analogy is to get a "blueprint/plan" before you start building.

    Good luck with your project.

  4. #4
    ThornofSouls's Avatar
    ThornofSouls is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Sweden, Gothenburg
    Posts
    42
    So i would be better of with an autonumber for each errand and tie it with the ClientID, righter den implement ClientErrandID.
    Yes it would be much easier to use and each client can have multiple errands, but how would i tie the errands together?
    On the other it could be i'm overthinking this. well, well.

    Em this might sound odd, but i try to describe errands & clients are related in this scenario.

    • tblErrand: is the main errand table. It is the actual errand.
    • tblErrandBefore: contains information about the client before he/ she was documented.
    • tblErrandAfter: contains information about the client after the errand ended for a short period of time.


    That is way i would like to tie the records together among with the ClientID. So the user could open a "case" and see all the related errands.
    So when the user opens the Preview window for a client he/ she have all the cases listed with the possibility to select and open the requested one and the open the needed errand.
    ErrandID, ErrandBeforeID, ErrandAfterID the the ID fields are autonumbers.


    This is how have have set up the current relations.

    Attachment 21894

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I get invalid attachment when trying to open your file.
    Let's get the facts understood before you start with Access.
    What exactly is an Errand? Can you give a clear, concise, plain English description so that it is clear to readers?
    I do not understand the Before and After. I'm sure it is clear in your mind, but not to me.

    As other posts will show you, you can construct and use a custom, incremental identifier. But, because you can, doesn't necessarily mean you should. Weigh the alternatives against your needs. Do some research, then make a decision.

    Good luck.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-24-2015, 06:54 PM
  2. Replies: 2
    Last Post: 01-14-2013, 11:27 PM
  3. Queries with multiple tables to create report
    By Solstice in forum Queries
    Replies: 1
    Last Post: 09-22-2011, 02:23 PM
  4. Multiple tables to create one Form??
    By Gravity101 in forum Forms
    Replies: 2
    Last Post: 06-02-2011, 06:37 AM
  5. Incrementing a field
    By Wayne311 in forum Programming
    Replies: 20
    Last Post: 01-20-2011, 06:21 PM

Tags for this Thread

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