JapanFreak
Registered User.
- Local time
- Today, 18:49
- Joined
- Aug 25, 2007
- Messages
- 45
Dear All,
I have a general question regarding my draft of a data model. Actually, I would like to make sure that I am not making a major mistake before I move on. Please find attached a ppt-File, which shows the relevant section and visualizes my explanations below.
Background
Table 1, called “tbl_AccountingEntry” contains accounting transactions. Table 2, called “tbl_Trades”, contains details about trades in stocks which relate to certain transactions in Table 1. Tables “tbl_Accounting” and “tbl_TransactionDetail” connect Table 1 and the various tables containing details.
Just as a remark:
1) The query…
…allows listing all accounts and their balance at a certain point in time (i.e., kind of a balance sheet and income statement).
2) The query…
…allows determining the composition of the stock portfolio at a certain point in time.
Question
On back of this background information, I have the following question. If I enter a new stock trade (e.g., 100 stocks of Ticker “ABC” for a price of $20/share), I type in (amongst other details) the following three datasets:
Table 2:
Quantity = 100
Price = $20
and
Table 1:
TransactionNo = 1
Transaction ID = 1
Credit/Debit = Debit
Account Debit = Securities
Amount Debit = $2,000
and
TransactionNo = 1
TransactionID = 2
Credit/Debit = Credit
Account Credit = Cash
Amount Credit = $2000
However, Amount (in Table 1) = Quantity x Price (in Table 2) and thus in a certain sense the same data is entered twice. This is from my point of view a potential source of error but I do not find an elegant way to avoid it. (Actually, I have the similar problems with the other tables containing details.)
My solution would be to enter the data via a Userform and to make sure that this is checking the data for consistency. But: Is that an intelligent way of solving the problem or should I construct the data model completely differently?
I would be grateful for any idea or thought.
Best regards,
JapanFreak
I have a general question regarding my draft of a data model. Actually, I would like to make sure that I am not making a major mistake before I move on. Please find attached a ppt-File, which shows the relevant section and visualizes my explanations below.
Background
Table 1, called “tbl_AccountingEntry” contains accounting transactions. Table 2, called “tbl_Trades”, contains details about trades in stocks which relate to certain transactions in Table 1. Tables “tbl_Accounting” and “tbl_TransactionDetail” connect Table 1 and the various tables containing details.
Just as a remark:
- Table 2 is not the only table containing details for transactions listed in Table 1.
- Not for every transaction in Table 1 there are details in Table 2.
- Not every trade listed in Table 2 leads to a cash movement (e.g., in the case of stock splits) and thus does not necessarily lead to a entry in Table 1.
1) The query…
Code:
[FONT=Arial]SELECT Account, sum(Amount) AS Amount [/FONT][FONT=Arial]FROM tbl_AccountingEntry [/FONT][FONT=Arial]WHERE dDate <= #12/31/2007# [/FONT][FONT=Arial]GROUP BY Account;[/FONT]
…allows listing all accounts and their balance at a certain point in time (i.e., kind of a balance sheet and income statement).
2) The query…
Code:
[FONT=Arial]SELECT Ticker, sum(Quantity) AS Quantity [/FONT][FONT=Arial]FROM tbl_Trades [/FONT][FONT=Arial]WHERE dDate <= #12/31/2007# [/FONT][FONT=Arial]GROUP BY Ticker;[/FONT]
…allows determining the composition of the stock portfolio at a certain point in time.
Question
On back of this background information, I have the following question. If I enter a new stock trade (e.g., 100 stocks of Ticker “ABC” for a price of $20/share), I type in (amongst other details) the following three datasets:
Table 2:
Quantity = 100
Price = $20
and
Table 1:
TransactionNo = 1
Transaction ID = 1
Credit/Debit = Debit
Account Debit = Securities
Amount Debit = $2,000
and
TransactionNo = 1
TransactionID = 2
Credit/Debit = Credit
Account Credit = Cash
Amount Credit = $2000
However, Amount (in Table 1) = Quantity x Price (in Table 2) and thus in a certain sense the same data is entered twice. This is from my point of view a potential source of error but I do not find an elegant way to avoid it. (Actually, I have the similar problems with the other tables containing details.)
My solution would be to enter the data via a Userform and to make sure that this is checking the data for consistency. But: Is that an intelligent way of solving the problem or should I construct the data model completely differently?
I would be grateful for any idea or thought.
Best regards,
JapanFreak