M
MikeC
I'm currently in the process of developing a new report for an existing
production A2K3 application. The primary purpose of the application is to
reconcile bank deposit transactions against G/L transactions...analogous to
a check book balancing application.
The report I'm developing needs to show previously matched transactions that
cross date boundaries. I believe a query or procedure can be developed for
this purpose, but the existing table design is not making the job easy for
me. I need some help to point me in the right direction.
The tblMatched table looks like this:
BID (Text)*
BDate (Datetime)*
BAmt (Currency)
GLID_1 (Text)**
GLID_2 (Long)**
GLAmt (Currency)
GLDate (Datetime)
*BID and BDate serve as a combination key for uniquely identifying bank
records.
**GLID_1 and GLID_2 serve as a combination key for uniquely identifying G/L
records.
The tblMatched table identifies all bank and G/L transactions that were
previously matched against one another. Records within this table may
represent matches of:
1) 1 bank record to 1 G/L record
2) 1 bank record to many G/L records
3) Many bank records to 1 G/L record
4) Many bank records to many G/L records
(NOTE: The matching process allows matches ONLY IF the total bank amount
equals the total G/L amount for each matched group.)
Scenario #4 is the one that is giving me trouble. The relationships for
groups of "many-to-many" matched records appear to be recursive. For each
"many-to-many" match, I believe I will need to:
1) Find a set of records having a GLDate that falls within a date range.
2) Uniquely identify the BID and BDate for each bank record within this
group.
3) Independent of date, uniquely identify any additional records that may
have been matched to these BID and BDate combinations.
4) Somehow repeat steps 2 and 3 until all records within a "many-to-many"
matched group have been identified.
Below is a relatively simple example Of 3 bank records matched to 2 G/L
records:
Here are the 3 bank records (BID, BDate, BAmt):
1) 23, 7/27/2007, $25.00
2) 41, 7/29/2007, $75.00
3) 67, 8/03/2007, $1,000.00
Group Total: $1,100.00
Here are the 2 G/L records (GLID_1, GLID_2, GLAmt, GLDate):
1) CBA, 4, $850.00, 7/26/2007
2) ABC, 1, $250.00, 8/01/2007
Group Total: $1,100.00
Here's how the matches are represented in the tblMatched table:
1) 23, 7/27/2007, $25.00, CBA, 4, $850.00, 7/26/2007
2) 41, 7/29/2007, $75.00, CBA, 4, $850.00, 7/26/2007
3) 67, 8/03/2007, $1,000.00, CBA, 4, $850.00, 7/26/2007
4) 67, 8/03/2007, $1,000.00, ABC, 1, $250.00, 8/01/2007
If we search for records having a GLDate between 7/01/2007 and 7/31/2007, we
will initially find the first 3 tblMatched records shown above. However,
the 4th tblMatched record would be excluded if the query only uses a simple
date filter. The 4th record also needs to be included because it is part of
the "many-to-many" matched group.
How do I create a query or procedure that will capture all records involved
in a "many-to-many" match?
Some matches involve more than 30 bank and G/L transactions, so the above
example is one of the easier ones.
Once all records involved in the relevant matches have been identified, then
I will be in a position to evaluate which records have crossed a month-end
boundary.
production A2K3 application. The primary purpose of the application is to
reconcile bank deposit transactions against G/L transactions...analogous to
a check book balancing application.
The report I'm developing needs to show previously matched transactions that
cross date boundaries. I believe a query or procedure can be developed for
this purpose, but the existing table design is not making the job easy for
me. I need some help to point me in the right direction.
The tblMatched table looks like this:
BID (Text)*
BDate (Datetime)*
BAmt (Currency)
GLID_1 (Text)**
GLID_2 (Long)**
GLAmt (Currency)
GLDate (Datetime)
*BID and BDate serve as a combination key for uniquely identifying bank
records.
**GLID_1 and GLID_2 serve as a combination key for uniquely identifying G/L
records.
The tblMatched table identifies all bank and G/L transactions that were
previously matched against one another. Records within this table may
represent matches of:
1) 1 bank record to 1 G/L record
2) 1 bank record to many G/L records
3) Many bank records to 1 G/L record
4) Many bank records to many G/L records
(NOTE: The matching process allows matches ONLY IF the total bank amount
equals the total G/L amount for each matched group.)
Scenario #4 is the one that is giving me trouble. The relationships for
groups of "many-to-many" matched records appear to be recursive. For each
"many-to-many" match, I believe I will need to:
1) Find a set of records having a GLDate that falls within a date range.
2) Uniquely identify the BID and BDate for each bank record within this
group.
3) Independent of date, uniquely identify any additional records that may
have been matched to these BID and BDate combinations.
4) Somehow repeat steps 2 and 3 until all records within a "many-to-many"
matched group have been identified.
Below is a relatively simple example Of 3 bank records matched to 2 G/L
records:
Here are the 3 bank records (BID, BDate, BAmt):
1) 23, 7/27/2007, $25.00
2) 41, 7/29/2007, $75.00
3) 67, 8/03/2007, $1,000.00
Group Total: $1,100.00
Here are the 2 G/L records (GLID_1, GLID_2, GLAmt, GLDate):
1) CBA, 4, $850.00, 7/26/2007
2) ABC, 1, $250.00, 8/01/2007
Group Total: $1,100.00
Here's how the matches are represented in the tblMatched table:
1) 23, 7/27/2007, $25.00, CBA, 4, $850.00, 7/26/2007
2) 41, 7/29/2007, $75.00, CBA, 4, $850.00, 7/26/2007
3) 67, 8/03/2007, $1,000.00, CBA, 4, $850.00, 7/26/2007
4) 67, 8/03/2007, $1,000.00, ABC, 1, $250.00, 8/01/2007
If we search for records having a GLDate between 7/01/2007 and 7/31/2007, we
will initially find the first 3 tblMatched records shown above. However,
the 4th tblMatched record would be excluded if the query only uses a simple
date filter. The 4th record also needs to be included because it is part of
the "many-to-many" matched group.
How do I create a query or procedure that will capture all records involved
in a "many-to-many" match?
Some matches involve more than 30 bank and G/L transactions, so the above
example is one of the easier ones.
Once all records involved in the relevant matches have been identified, then
I will be in a position to evaluate which records have crossed a month-end
boundary.