hi,
Say Tbl-A consist of dec09 month end position& Tbl-B is Jan10 position
It may make sense to store account balances, but under most
circumstances it is wrong to do that.
It is wrong to store the different months end balances in different tables.
Normalized it should be:
MontlyEndBalance:
[ID] AutoNumber
[Year] Number (Long), Not Null, Not Empty
[Month] Number (Long) Not Null, Not Empty
[Account] your data type Not Null, Not Empty
[Balance] Currency Not Null, Not Empty
With a combined primary key over [Year], [Month] and [Account]. Then you
can simply select waht you want.
Assuming
Tbl-A
FieldAcno FieldBal
A 1000.00 (still remain active from dec09 to jan10)
B 500.00 (active in dec09 but settled in Jan10)
C 400.00 (active in dec09 but settled in Jan10)
Tbl-B
FieldAcno FieldBal
A 900.00
D 300.00 (new accounts created in Jan10)
E 200.00 (new accounts created in Jan10)
When i tick join properties for fieldacno 1..i will only get A
When i tick 2 or 3 i can only display ABC or ADE.
What i expect to display in my query is all data as follow
FieldAcno FieldBal
A 900.00
D 300.00 (new accounts created in Jan10)
E 200.00 (new accounts created in Jan10)
B 500.00 (active in dec09 but settled in Jan10)
C 400.00 (active in dec09 but settled in Jan10)
Does this result make really sense?
The interpretation of the fact that in your January 2010 table the
accounts B and C are missing would be: They do not longer exist.
Otherwise you need the UNION ALL with an additional restriction:
qryNormalized:
SELECT 200912 AS Sort, FieldAcno, FieldBal FROM [TblA]
UNION ALL
SELECT 201001 AS Sort, FieldAcno, FieldBal FROM [TblA]
and
SELECT *
FROM qryNormalized O
WHERE O.Sort =
(
SELECT Max(Sort)
FROM qryNormalized I
WHERE I.FieldAcno = O.FieldAcno
)
mfG
--> stefan <--