Access 2003 database being updated using Access 2007 on Windows XP Ver 5.1.2600
I have a drop down menu that populates the form chosen into a sub form named chdSubForm. When I press the retrieve button on the form that has opened inside chdSubForm I receive a message, The expression you entered refers to an object that is closed or does not exist.
Example: I choose from the drop down menu: Address Change Base 24.
The form frm_Masterfile_AdrsChange_Base24) populates in chdSubForm within the main form frm_Masterfile_1Audits.
I have a button on frm_Masterfile_AdrsChange_Base24 that should bring back data to that form and the main form frm_Masterfile_1Audits.
The data, based on the record ID, *will* populate on the form frm_Masterfile_1Audits, but I receive the following error when attempting to populate data on the form frm_Masterfile_AdrsChange_Base24 (This is the form with the retrieve button) The expression you entered refers to an object that is closed or does not exist.
Code for Retrieve button on frm_Masterfile_AdrsChange_Base24:
Dim AuditID As Long, AuditType As Integer Dim db As Database, RS1 As Recordset
Set db = CurrentDb() Set RS1 = db.OpenRecordset("tbl_Masterfile_Audits", dbOpenDynaset)
***This data *is* returned to the main form with this code: Forms!frm_Masterfile_1Audits!txtAuditorName.Value = RS1!Auditor Forms!frm_Masterfile_1Audits!cboEmpName.Value = RS1!EmpID Forms!frm_Masterfile_1Audits!txtMerchantNumber.Val ue = RS1!MerchNum
***This code is highlighted with this error message: The expression you entered refers to an object that is closed or does not exist. txtAC_MSTAddress.Value = RS1!txtAC_MSTAddress.Value txtAC_MSTCity.Value = RS1!txtAC_MSTCity.Value
I tried: [Forms]![frm_Masterfile_AdrsChange_Base24]!txtAC_MSTAddress.Value = RS1!txtAC_MSTAddress.Value [Forms]![frm_Masterfile_AdrsChange_Base24]!txtAC_MSTCity.Value = RS1!txtAC_MSTCity.Value
Subform syntax is a little weird. You almost have it right. Keep in mind the Forms collection stores all of the forms that are currently open. When you open a form as a subform it is NOT an open form. Instead it is now a control on the open form. To access the subform controls you need to drill down to the controls through the open form like this: