View Full Version : Can you use the same field in one table multiple times in another table?


DawnRoush
06-22-2003, 08:37 PM
I'm not very computer literate -- so please be patient. I'm making a database for my court reporting. I have a table with attorney's names and addresses, etc. I also am creating a table as invoices. When I do a job, there are always multiple attorneys there and each much be listed on each invoice for that job. If there's four attorneys there, they each are billed a separate invoice for what they "order" but all four attorneys must be listed on all four invoices. I want to be able to have four AttorneyName fields, for instance, in my invoice table to be able to pull all four attorneys in. Is that possible? From what I've read and tried it won't accept a field name more than once in a table and if I use different field names (AttorneyName1, AttorneyName2) it's not going to be able to pull it from my attorney table because the field names won't be the same. Is that true? What can I do?

Also, this may be a little more involved; so maybe you can just point me to where I need to look to find out how to do this. I want to be able to make a section in my invoice where I list what services the attorney is being billed for (time, transcript pages, ASCII disks, exhibits, etc.) and include a quantity of each and then create a total. I have created my "Services" table but don't know how to do it in my "Invoice" table to pull those in and make it work. I know this is all pretty basic stuff, but I'm really trying. Thanks for your help!
Dawn

dcx693
06-22-2003, 08:59 PM
Sounds like you're a beginner to databases. You should probably get yourself a good book on Access, especially one with a good chapter on database design.

I think I undertstand what you're trying to do. I'm guessing that you come from a spreadsheet background since what you're describing would fit well into that framework. Relational databases (like Access) are a bit different in terms of their structure. Their flexibility is also what makes them a bit confusing at first, but ultimately so much more powerful for handling data storage.

I'll make some basic suggestions on how you should structure your database. You've have a table with attorney information. Make sure you have in that table a field called AttorneyID (or something like that) which uniquely identifies each attorney. (Access makes it easy to uniquely idenitfy each record within a table. It provides Autonumber fields.) You also mention you have an invoice table. It should also have a field called InvoiceID that unique identifies each invoice.

Now, here's the potentially confusing but key part: create a third table that matches attorneys with invoices. This will create a many-to-many relationship between the attorneys and invoices. After all, an attorney can appear on many different invoices. Likewise, an invoice can be assigned to multiple attorneys. It's not a one-to-one relationship, or even a one-to-many relationship.

With that third table in place, you can assign as many attorneys to an invoice as you like. You can assign just one, four, or as many attorneys as you have.

As for your last question regarding services, you can create an invoice details table that itemizes the services. In this case, the invoice and the invoice details table would have a one-to-many relationship. One invoice can have many services associated with it.

Of course, once you've set up your database structure, you'll need to create forms and such to facilitate data entry. You should really get yourself a good Access manual and dive in. You'll thank yourself for doing it "right" by researching the best way to do it the first time.