I am working on a database that will allow my users to query financial records. I'm setting up the entire thing to use VBA code and forms. I'm running into an interesting problem that I haven't been able to think of a decent solution for, and I thought someone here might have some ideas. I'll need to explain the organization of our database first. Our financial records are stored by a combination of fund, orgn (organization) and acct (account) numbers. For example, one of my tables would have a record for fund 113002, orgn 5251 and acct 52003, or 113002-5501-52003 or any other combination of these. I have 5 different tables storing what the sum totals are for each combination of fund/orgn/acct, seperated into years (i.e. I have a table that shows this data for 1999, a table for 2000, and ones for 2001, 2002, and 2003). So, I need to make some queries that will allow my users to select any combination of these years, and create a table displaying the fund/orgn/acct combinations and the sum totals for each of the selected years. So, if they selected all 5 years, my table would have fields for fund, orgn, acct, 1999total, 2000total, 2001total, 2002total and 2003total.
The tricky part is that some combinations appear in some years but not in others. I need my table to have all the appropriate records, even if a specific fund/orgn/acct combination showed up in only one or two years. The problem is that doing an ordinary inner join will only pick up records that show up in all years. I know about outer joins, but I don't think it will help in this situation. One solution I've thought of (but don't really want to impliment, for obvious reasons) is to create a series of queries. I'd start with a make table query that found records in all 5 tables, then do a series append query (that would append to the table I just made) that found records in each combination of 4 tables, then do it for each combination of 3 tables, each combination of 2, and each seperate tables. I could do this - but it would need 31 seperate queries in order to accomplish this.
So, I'm bringing this problem up here with the hope that someone might have a solution. Is there someway that I can have each of my 5 tables join to the others in such a way that all the records from all the tables are kept, and anytime records match between tables, they're joined together into one single record?
The tricky part is that some combinations appear in some years but not in others. I need my table to have all the appropriate records, even if a specific fund/orgn/acct combination showed up in only one or two years. The problem is that doing an ordinary inner join will only pick up records that show up in all years. I know about outer joins, but I don't think it will help in this situation. One solution I've thought of (but don't really want to impliment, for obvious reasons) is to create a series of queries. I'd start with a make table query that found records in all 5 tables, then do a series append query (that would append to the table I just made) that found records in each combination of 4 tables, then do it for each combination of 3 tables, each combination of 2, and each seperate tables. I could do this - but it would need 31 seperate queries in order to accomplish this.
So, I'm bringing this problem up here with the hope that someone might have a solution. Is there someway that I can have each of my 5 tables join to the others in such a way that all the records from all the tables are kept, and anytime records match between tables, they're joined together into one single record?