Which is the best way to relate tables sharing same needs? (1 Viewer)

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 10:09
Joined
Mar 22, 2009
Messages
777
All of the following Bills has to be paid:

1.Purchase Bills (Purchase Table)
2.Sales Bills (Sales Table)
3.Expense Bills (Expense Table)

So the Payment table is having the following fields:
  1. ID (Autonumber)
  2. Date_Time
  3. Paid_For (Combo box having "Purchase", "Sales" and "Expense" as list values)
  4. Ref_No (Purchase_ID or Sales_ID or Expense_ID)
  5. Mode ("Cash","Cheque","Online")
  6. Amount
  7. CloseBillOnThisPayment (Boolean)

So. My Question here is Which is the right way to get these bills paid?

  1. By Creating individual tables like Purchase_Payments, Sales_Payments and Expense_Payments?
    or
  2. The above design is OK?

Kindly share your opinion... Thank you for reading
 

Ranman256

Well-known member
Local time
Today, 00:39
Joined
Apr 9, 2015
Messages
4,339
You don't need 3 tables, just 1 but with a field for PURCH,SALES, or EXP.
And 1 payment table.

This way you payoff 1 purch ID, and 1 paymt ID.
 

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 10:09
Joined
Mar 22, 2009
Messages
777
Excellent Answer. Thank you.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:39
Joined
Feb 28, 2001
Messages
27,140
Unless you are working for a branch of the U.S. Government, RanMan's answer is spot-on. Now, here is a possible wrinkle. If you pay cash, check, or credit transfer and have different government-based requirements for each mode of payment because of discount or other tracking differences, it is POSSIBLE (but still not the best answer) to use different tables. But I would not use different tables for a business situation that probably involves direct bank transactions for three different expense sources.
 

Users who are viewing this thread

Top Bottom