MS Access 2010 accdb.
We have a main form, frmLoanIssueData, and a number of sub forms.
One subform, FrmRefinanceSubForm, has a combo box control with Row Source as this sql
The purpose here is to provide a list of records that fit the sql where field APLPK = txtAPLPK in the main form - refer DLookup in red.
All works perfectly... except sometimes, when you click on the combo box, the DLookup has changed to read frmLoanProcessData instead of frmLoanIssueData.
While typing this, I realise what may be causing the confussion.
Calling the mainform, depending on the status of the Application, either frmLoanIssueData or frmLOanProcessData will be opened.
Is it possible that when one version is opened, the subform remembers the sql and when the next version is opened, the sql hasn't changed.
I guess, what should happen is I make it so the appropriate Row Source is loaded each time the subform is opened rather then have it hard coded.
Sorry for the ramblings but it looks like the issue is down to two different forms using the same subform which is not possible if you hard code an sql in the subform to refer to a field on the main form which of course is not the same main form every time
We have a main form, frmLoanIssueData, and a number of sub forms.
One subform, FrmRefinanceSubForm, has a combo box control with Row Source as this sql
Code:
SELECT TBLAPPLOAN.APLPK, TBLAPPLOAN.APLACCDET, TBLLOAN.LDPK, tblLoanIssueStatus.IssueDate, QryLoanTotalToPayResult.SumOfLoanTotalToPay, TblRefinance.RefinanceID
FROM (((TBLAPPLOAN INNER JOIN TBLLOAN ON TBLAPPLOAN.APLACCDET = TBLLOAN.ADPK) INNER JOIN tblLoanIssueStatus ON TBLLOAN.LDPK = tblLoanIssueStatus.LoanID) INNER JOIN QryLoanTotalToPayResult ON tblLoanIssueStatus.LoanID = QryLoanTotalToPayResult.LoanID) LEFT JOIN TblRefinance ON QryLoanTotalToPayResult.LoanID = TblRefinance.OldLoanID
WHERE (((TBLAPPLOAN.APLPK)=[COLOR=red]DLookUp("[APLPK]","TBLAPPLOAN","[APLPK] = " & [Forms]![frmLoanIssueData]![txtAPLPK]))[/COLOR] AND ((TblRefinance.RefinanceID) Is Null))
ORDER BY TBLLOAN.LDPK DESC;
All works perfectly... except sometimes, when you click on the combo box, the DLookup has changed to read frmLoanProcessData instead of frmLoanIssueData.
While typing this, I realise what may be causing the confussion.
Calling the mainform, depending on the status of the Application, either frmLoanIssueData or frmLOanProcessData will be opened.
Is it possible that when one version is opened, the subform remembers the sql and when the next version is opened, the sql hasn't changed.
I guess, what should happen is I make it so the appropriate Row Source is loaded each time the subform is opened rather then have it hard coded.
Sorry for the ramblings but it looks like the issue is down to two different forms using the same subform which is not possible if you hard code an sql in the subform to refer to a field on the main form which of course is not the same main form every time