Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    garciaroizm is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    15
    The way the form looks is exactly the way our paper tickets look like. That's the way management wants it. The multiple material, quantity, hours, etc fields are sometimes used. All jobs have at least 2 employees on them, but there are many jobs where there can be anywhere from 2-12 employees on them and material and other fields will all be used and most times will need more than one ticket.

  2. #17
    jerepois is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    16
    Garciaroizm,

    The way that your data is stored is very unorganized as said before.

    Here is an example of normalizing the data.

    Ticket { TicketID, TicketOpenDate, TicketClosedDate }
    Companies { CompanyID, CompanyName }
    Job { JobID, JobDesc, JobCompleted }
    Material { MaterialID, MaterialCode, MaterialDesc, MaterialCost }
    Vehicle { VehicleID, VehicleName, VehicleDescription, VehicleBillPerHour }
    Employee { EmpID, EmpName, TradeID, EmpPhone}
    Trade { TradeID, TradeName, TradeBillPerHour }

    The tables above should have no duplication of information.


    Once you have broken all your data into tables we need to now create a tables that will track the information


    usedVehicle { (VehicleID, TicketID) , VehicleRepair }
    UsedEmployee { (EmpID, JobID, TicketID), UsedEmpHrs }
    UsedMaterial { (MaterialID, TicketID), UsedMaterialQty}
    usedJob { (JobID, TicketID), JobCompleted }
    usedCompany { (CompantID, TicketID) }

    These tables is how you track your data. Your main tables should be used as a reference. The Primary Keys (ID) fields will allow you to reference back to these tables. The used tables are where you store the actual data, which is the reference identification keys to your main tables. IF you noticed all these reference the TickedID and the ID of another table. This is how you create your primary identifying key for your used tables.

    This will allow you to have multiple entries per ticket. So you could have more than one company, Job, Material, Employee, and Vehicle per ticket.

    I just quickly threw this together but I hope you get the concept behind this and are able to apply it to your database.

  3. #18
    garciaroizm is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    15
    Ok I started a new database, I made all the tables that will be used to reference which are the main tables, then I made the used tables that will hold the data. I made main tables primary key to be ex: materialID, vehicleID, companyID, employeeID, leaseID, and ticketID. Then in the used tables the primary key is ticketID in all tables. Is that correct?

  4. #19
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I presume these are 1-to-many relationships. For each ticket there can be many materials, employees, vehicles. This means TicketID is primary key in Tickets table and foreign key in the Used tables. Same for the lookup tables. MaterialID is primary key in Materials and foreign key in UsedMaterial.

    The primary keys can be autonumber type field. The foreign keys will then be a number (long integer) type field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    jerepois is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    16
    Quote Originally Posted by garciaroizm View Post
    Ok I started a new database, I made all the tables that will be used to reference which are the main tables, then I made the used tables that will hold the data. I made main tables primary key to be ex: materialID, vehicleID, companyID, employeeID, leaseID, and ticketID. Then in the used tables the primary key is ticketID in all tables. Is that correct?

    http://office.microsoft.com/en-ca/ac...001054693.aspx

    This link will explain how you can make both the Reference ID ex.(MaterialID) and the TicketID to be the Used tables Primary key. This will create a 1-M relationship where only one type ex.(MaterialID) can be used per ticket but is able to be applied to more than one ticket at a time. Product numbers rarely change in my experience. I would make the two Foreign keys the primary key. It makes sense if you do not need any more columns.

  6. #21
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by jerepois View Post
    This link will explain how you can make both the Reference ID ex.(MaterialID) and the TicketID to be the Used tables Primary key.
    I would advise against someone starting out to use a Composite or Compound key.

  7. #22
    jerepois is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    16
    I guess, but either way he still needs those fields and can use a autonumber field for his Usedtables primary key

  8. #23
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The Used tables don't need primary key if they don't have related child tables. However, setting the two fields as compound key (or at least a compound index) will prevent duplicating the pairs.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #24
    garciaroizm is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    15
    Ok I think I got it... Companies table companyid is primary key, in usedcompany table companyid is foreign key. That goes for all tables. Do I need a usedticket table?

  10. #25
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No. Users do not 'pick' a ticket during data entry, like they 'pick' employee, material, vehicle. Data entry initiates a ticket record and users select the resources to associate with that ticket.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-23-2013, 10:44 AM
  2. Replies: 4
    Last Post: 10-06-2012, 11:57 AM
  3. Replies: 3
    Last Post: 07-13-2012, 06:33 AM
  4. Selecting records based on 2 combo boxes
    By comteck in forum Database Design
    Replies: 1
    Last Post: 07-10-2012, 06:05 PM
  5. Replies: 1
    Last Post: 07-30-2011, 03:21 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