I have a question referencing Navigation forms and how to reference controls on a Navigation subform. I got my syntax to work, but I do not understand how it can work. I am on a form that is not part of a Navigation control and needing to get a value from a combo box that is on a subform of the Nav control. The syntax that worked for me does not seem like it should be able to work.
My Navigation form is frmMainNav and the subform control is named sfrmMainNav. One of the Navigation subforms is frmConfigureSampleGroupSpecs. From frmConfigureSampleGroupSpecs with a cmdButton I call a form to add new records. I'll just call it frmA. This frmA is NOT on any Navigation control.
On frmA I have a hidden text box that I use to store an ID number from one of the list boxes on frmConfigureSampleGroupSpecs. I use that ID number to filter a combo on frmA. My code for getting that ID number from frmConfigureSampleGroupSpecs worked just fine until I made that form a subform on the Navigation control. The assignment statement that worked initially was "= Forms!frmConfigureSampleGroupSpecs!cboSelectSite.column(1)". When the form was made a Navigation control subform, and the assignment code quit working, I used syntax I saw on another web site and changed the text box assignment to "=Forms!frmMainNav.sfrmMainNav.Form!cboSelectSite.Column(1)". It did not work. Then, I looked at that statement and thought, well it cant work because I am not telling Access what the name of the form is which holds the cbo whose column(1) value I want.
So, my next attempt was what I guess might be called a "fully qualified name", if that terminology is correct. So my next attempt was "=Forms!frmMainNav.sfrmMainNav.frmConfigureSampleGroupSpecs.cboSelectSite.column(1)"
Now, that made sense to me but apparently not to Access. So, I tried several others including "=Forms!frmMainNav.sfrmMainNav.Form!frmConfigureSampleGroupSpecs.cboSelectSite.column(1).
After multiple tries, and a lucky guess, this simple little syntax below worked:
=[Forms]![frmMainNav].[sfrmMainNav]![cboSelectSite].[column](1).
Can you explain to me please how this can possibly work? How is it possible that Access can know which subform this combo cboSelectSite is on? The syntax above does not tell Access which subform to look at to find the combo, but it works??
Posted by: david.pratt@outlook.com
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar