P
Philip Herlihy
I'm the treasurer of a Badminton Club. I want to create a database
which will record which members monthly subscriptions are due, who has
paid, and which will also keep track of what the club's bank account
balance should be.
I've ended up thinking I should have a single table of transactions.
However, some transactions are payments (a cheque from a member, or a
payment to our coach) and some are "charges", e.g. a batch of appended
records to indicate that the November monthly subscription is due for
each member.
A screenshot of my relationships diagram is available here:
http://bit.ly/2uvhxn
(the latest in a series of structures).
It can't be right! When I generate forms nothing quite works!
To explain the thinking behind it:
All Transactions are made with Contacts. Most of my Contacts are
Members (for whom I store additional details) but a few are not: the
Bank, our Coach, for example. So I thought I'd try and create a
one-to-one relationship between Contact and Member - if the Contact
isn't a Member then the foreign key in the Contacts table is null. I've
indexed the foreign key MemberID in the Contacts table so that
duplicates are not allowed but Nulls are ignored. (Yes, I do wonder if
an "optional" one-to-one relationship isn't a tautology!)
On the left-hand side of the diagram, I've tried to show that
Transactions can be a Payment or a Charge (respectively, an incoming
cheque, or a batch of appendsto make the November subscription payable).
There's a "Transaction Type" field in the Transactions table to
distinguish the two types.
You won't be surprised to know that I haven't tried working with this
type of relationship before (I can anticipate some mirth at my
attempts). It's probably crackers, but the attempt is prompted by a
history of programming in Object-oriented languages, and I was trying to
factor out the general (all these objects are Contacts) and the more
specific (some Contacts are Members). Similarly, a Transaction might be
a Payment or a Charge.
If this is possible, and I can get it right, I'd hope to be able to
process a cheque from a member into the system (tap details into a
single form) and use different queries to list what each member
currently owes, to predict what the club's bank balance should be, and
even to list the number and total value of cheques I haven't paid in yet
(so I can fill in the payment slip).
I'll be grateful for any advice, both in the specifics of what I'm
trying to do, and those principles which I clearly haven't grasped yet!
Phil, London
which will record which members monthly subscriptions are due, who has
paid, and which will also keep track of what the club's bank account
balance should be.
I've ended up thinking I should have a single table of transactions.
However, some transactions are payments (a cheque from a member, or a
payment to our coach) and some are "charges", e.g. a batch of appended
records to indicate that the November monthly subscription is due for
each member.
A screenshot of my relationships diagram is available here:
http://bit.ly/2uvhxn
(the latest in a series of structures).
It can't be right! When I generate forms nothing quite works!
To explain the thinking behind it:
All Transactions are made with Contacts. Most of my Contacts are
Members (for whom I store additional details) but a few are not: the
Bank, our Coach, for example. So I thought I'd try and create a
one-to-one relationship between Contact and Member - if the Contact
isn't a Member then the foreign key in the Contacts table is null. I've
indexed the foreign key MemberID in the Contacts table so that
duplicates are not allowed but Nulls are ignored. (Yes, I do wonder if
an "optional" one-to-one relationship isn't a tautology!)
On the left-hand side of the diagram, I've tried to show that
Transactions can be a Payment or a Charge (respectively, an incoming
cheque, or a batch of appendsto make the November subscription payable).
There's a "Transaction Type" field in the Transactions table to
distinguish the two types.
You won't be surprised to know that I haven't tried working with this
type of relationship before (I can anticipate some mirth at my
attempts). It's probably crackers, but the attempt is prompted by a
history of programming in Object-oriented languages, and I was trying to
factor out the general (all these objects are Contacts) and the more
specific (some Contacts are Members). Similarly, a Transaction might be
a Payment or a Charge.
If this is possible, and I can get it right, I'd hope to be able to
process a cheque from a member into the system (tap details into a
single form) and use different queries to list what each member
currently owes, to predict what the club's bank balance should be, and
even to list the number and total value of cheques I haven't paid in yet
(so I can fill in the payment slip).
I'll be grateful for any advice, both in the specifics of what I'm
trying to do, and those principles which I clearly haven't grasped yet!
Phil, London