Hi All
I have done some research on this already, and realise that my form doesnt work as it is based on a stacked query, but I dont know what the best solution to this is.
I have tblPerson with client details. tblAddressHistory with addresses for each client. I use 2 queries to get the most recent address for each client:
qryCurrentAddress_A (gets the most current PropID for each person)
qryCurrentAddress_B (adds in the rest of the address details)
then I have a query to link the current address with the person, which the form is based upon:
The form doesn't allow edits or additions.
I am thining one work around could be to change the final query to a make-table query - however would that update tblPerson and tblAddressHistory?
The other idea is that the current address could be presented as a subform with the main person form however I think this would be a bit messy.
Please could I call upon your collective experience for some advice and /or better solutions.
Thanks
Kev
I have done some research on this already, and realise that my form doesnt work as it is based on a stacked query, but I dont know what the best solution to this is.
I have tblPerson with client details. tblAddressHistory with addresses for each client. I use 2 queries to get the most recent address for each client:
qryCurrentAddress_A (gets the most current PropID for each person)
Code:
SELECT DISTINCT tblPropHistory.ID, Max(tblPropHistory.MovedIn) AS MaxOfMovedIn
FROM tblPropHistory
GROUP BY tblPropHistory.ID;
qryCurrentAddress_B (adds in the rest of the address details)
Code:
SELECT DISTINCT tblPropHistory.ID, tblPropHistory.PropID, tblPropHistory.PropA1, tblPropHistory.PropA2, tblPropHistory.PropA3, tblPropHistory.PropAPostCode, tblPropHistory.MovedIn, tblPropHistory.MovedOut, tblPropHistory.Tenure, tblPropHistory.Notes, tblPropHistory.[Current User], tblPropHistory.MortAmountOutstanding, tblPropHistory.MortType, tblPropHistory.MortRepemption, tblPropHistory.CMI, tblPropHistory.MortArrears, tblPropHistory.MRef, tblPropHistory.Mortgagee, tblPropHistory.MortOutcome, tblPropHistory.MortReason, tblPropHistory.Rent, tblPropHistory.TenancyType, tblPropHistory.TenancyStatus, tblPropHistory.Arrears, tblPropHistory.TenancyStartDate, tblPropHistory.TenancyEndDate, tblPropHistory.NoticeExpirationDate, tblPropHistory.PosessionExpirationDate, tblPropHistory.WarrentExpirationDate, tblPropHistory.Agent, tblPropHistory.Landlord, tblPropHistory.Current, tblPropHistory.LLPGAdd1, tblPropHistory.LLPGAdd2, tblPropHistory.LLPGAdd3, tblPropHistory.LLPGAdd4, tblPropHistory.LLPGAddPC, tblPropHistory.LLPGAddUPRN
FROM tblPropHistory INNER JOIN qryCurrentAddress_A ON tblPropHistory.MovedIn = qryCurrentAddress_A.MaxOfMovedIn
WHERE (((tblPropHistory.ID)=[qryCurrentAddress_A]![ID]));
then I have a query to link the current address with the person, which the form is based upon:
Code:
SELECT qryPerson.*, qryCurrentAddress_B.PropID, qryCurrentAddress_B.PropA1, qryCurrentAddress_B.PropA2, qryCurrentAddress_B.PropA3, qryCurrentAddress_B.PropAPostCode, qryCurrentAddress_B.MovedIn, qryCurrentAddress_B.MovedOut, qryCurrentAddress_B.Tenure, qryCurrentAddress_B.Notes, qryCurrentAddress_B.[Current User], qryCurrentAddress_B.MortAmountOutstanding, qryCurrentAddress_B.MortType, qryCurrentAddress_B.MortRepemption, qryCurrentAddress_B.CMI, qryCurrentAddress_B.MortArrears, qryCurrentAddress_B.MRef, qryCurrentAddress_B.Mortgagee, qryCurrentAddress_B.MortOutcome, qryCurrentAddress_B.MortReason, qryCurrentAddress_B.Rent, qryCurrentAddress_B.TenancyType, qryCurrentAddress_B.TenancyStatus, qryCurrentAddress_B.Arrears, qryCurrentAddress_B.TenancyStartDate, qryCurrentAddress_B.TenancyEndDate, qryCurrentAddress_B.NoticeExpirationDate, qryCurrentAddress_B.PosessionExpirationDate, qryCurrentAddress_B.WarrentExpirationDate, qryCurrentAddress_B.Agent, qryCurrentAddress_B.Landlord, qryCurrentAddress_B.Current, qryCurrentAddress_B.LLPGAdd1, qryCurrentAddress_B.LLPGAdd2, qryCurrentAddress_B.LLPGAdd3, qryCurrentAddress_B.LLPGAdd4, qryCurrentAddress_B.LLPGAddPC, qryCurrentAddress_B.LLPGAddUPRN
FROM qryPerson LEFT JOIN qryCurrentAddress_B ON qryPerson.ID = qryCurrentAddress_B.ID;
The form doesn't allow edits or additions.
I am thining one work around could be to change the final query to a make-table query - however would that update tblPerson and tblAddressHistory?
The other idea is that the current address could be presented as a subform with the main person form however I think this would be a bit messy.
Please could I call upon your collective experience for some advice and /or better solutions.
Thanks
Kev