Hi All,
I'm hoping I can get some help on the following.
I have a form, which has a complex union query that I set only on open form action to a listbox.
The form opens in 2 secs when on my hard drive; however, when I put the database on the network, it takes approximately 1 min 41 secs to open without any other users connected.
I've searched for various ways to improve this speed and I've already done the following:
- Removed Name Auto Correct
- Used Union All in my query join
- Kept a persistent database connection via a hidden form bound to a table
I'm just wondering if there's anything else I can do. It is something to do with the query populating the listbox, as it opens quite fast when I don't set the query as the rowsource.
I am restricted in that I can't separate the BE from the FE and it all has to reside in the MDB.
I appreciate your assistance.
I've included below a portion of my query as well:
I'm hoping I can get some help on the following.
I have a form, which has a complex union query that I set only on open form action to a listbox.
The form opens in 2 secs when on my hard drive; however, when I put the database on the network, it takes approximately 1 min 41 secs to open without any other users connected.
I've searched for various ways to improve this speed and I've already done the following:
- Removed Name Auto Correct
- Used Union All in my query join
- Kept a persistent database connection via a hidden form bound to a table
I'm just wondering if there's anything else I can do. It is something to do with the query populating the listbox, as it opens quite fast when I don't set the query as the rowsource.
I am restricted in that I can't separate the BE from the FE and it all has to reside in the MDB.
I appreciate your assistance.
I've included below a portion of my query as well:
Code:
SELECT DLookUp("Username","tblRestrictions","username='jjones'") AS Person, tblGeneralPolicyHome.PolicyTerm, tblPoliciesHome.PolID, tblPoliciesHome.SiteID, tblGeneralPolicyHome.[code], ([Buildings Limit]+[Contents Limit])*DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code]) AS [Building + Contents in USD], IIf([PolicyTerm]="NEW",Format(DLookUp("buildings_content_nb","tblRestrictions","username='jjones'"),"#,##0"),Format(DLookUp("buildings_content_rnl","tblRestrictions","username='jjones'"),"#,##0")) AS [YOUR Limit In USD]
FROM tblPoliciesHome INNER JOIN tblGeneralPolicyHome ON tblPoliciesHome.PolID = tblGeneralPolicyHome.PolID
WHERE (((tblGeneralPolicyHome.PolicyTerm)="NEW") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_nb","tblRestrictions","username='jjones'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="NEW") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_nb","tblRestrictions","username='jjones'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="RENEWAL") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_rnl","tblRestrictions","username='jjones'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="RENEWAL") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_rnl","tblRestrictions","username='jjones'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID))
ORDER BY tblPoliciesHome.SiteID DESC;
union all SELECT DLookUp("Username","tblRestrictions","username='jsmith'") AS Person, tblGeneralPolicyHome.PolicyTerm, tblPoliciesHome.PolID, tblPoliciesHome.SiteID, tblGeneralPolicyHome.[code], ([Buildings Limit]+[Contents Limit])*DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code]) AS [Building + Contents in USD], IIf([PolicyTerm]="NEW",Format(DLookUp("buildings_content_nb","tblRestrictions","username='jsmith'"),"#,##0"),Format(DLookUp("buildings_content_rnl","tblRestrictions","username='jsmith'"),"#,##0")) AS [YOUR Limit In USD]
FROM tblPoliciesHome INNER JOIN tblGeneralPolicyHome ON tblPoliciesHome.PolID = tblGeneralPolicyHome.PolID
WHERE (((tblGeneralPolicyHome.PolicyTerm)="NEW") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_nb","tblRestrictions","username='jsmith'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="NEW") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_nb","tblRestrictions","username='jsmith'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="RENEWAL") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_rnl","tblRestrictions","username='jsmith'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID)) OR (((tblGeneralPolicyHome.PolicyTerm)="RENEWAL") AND ((IIf([Cancelled]=-1,"Y",""))<>"Y") AND (([Buildings Limit]+[Contents Limit])>DLookUp("buildings_content_rnl","tblRestrictions","username='jsmith'")/DLookUp("[Rate to USD]","tblCurrency","[code]=" & [code])) AND ((tblGeneralPolicyHome.PolID)=[forms]![Home Policy].PolID))
ORDER BY tblPoliciesHome.SiteID DESC