Resident Gurus
The following is a true story, only the form names have been changed to protect your sanity.
- have a form (frmA)with a private sub that is called each time a control on the form is updated.
- Data from the form is in a table (TblA) and is allowed to store duplicate data.
- The sub on frmA does a dcount to check if there is a duplicate record in the underlying table and, if so, displays a message to that effect.
if dcount("[recnum]","TblA","[recnum]=[forms]![FrmA]![recnum])>1 then msgbox "duplicate exists",vbokonly
I'm amalgamating the forms in my database onto one main form (FrmMain) and each form has its own page within FrmMain.
The Problem:
When opened as a standalone, FrmA correctly references the control recnum. However, when opened as a subform on a page in FrmMain I get the message:
"The object doesn't contain the Automation object Forms!FrmA!recnum"
I've tried various and sundry methods and wordings to reference the control , the longest one would be this:
Forms!FrmMain!Page2.Forms!FrmA!recnum.
Alas, all to no avail.
Curiously (for me at least) Everything else in FrmA private sub references as me.control with no problems. It is only this dcount procedure that's being a right royal P in the A.
And so I throw this question out to the void.
help me, dear Gurus. Bathe me in the light of your infinite knowledge and wisdom and chocolate sauce.
Cheers
xentaur.
The following is a true story, only the form names have been changed to protect your sanity.
- have a form (frmA)with a private sub that is called each time a control on the form is updated.
- Data from the form is in a table (TblA) and is allowed to store duplicate data.
- The sub on frmA does a dcount to check if there is a duplicate record in the underlying table and, if so, displays a message to that effect.
if dcount("[recnum]","TblA","[recnum]=[forms]![FrmA]![recnum])>1 then msgbox "duplicate exists",vbokonly
I'm amalgamating the forms in my database onto one main form (FrmMain) and each form has its own page within FrmMain.
The Problem:
When opened as a standalone, FrmA correctly references the control recnum. However, when opened as a subform on a page in FrmMain I get the message:
"The object doesn't contain the Automation object Forms!FrmA!recnum"
I've tried various and sundry methods and wordings to reference the control , the longest one would be this:
Forms!FrmMain!Page2.Forms!FrmA!recnum.
Alas, all to no avail.
Curiously (for me at least) Everything else in FrmA private sub references as me.control with no problems. It is only this dcount procedure that's being a right royal P in the A.
And so I throw this question out to the void.
help me, dear Gurus. Bathe me in the light of your infinite knowledge and wisdom and chocolate sauce.
Cheers
xentaur.