F
Fred Boer
Hello:
I posted this question a couple of days ago under the heading "Subform
reference returns value from query" (not a great subject heading, but I
couldn't think of anything better...), and got no answer, and I am still
curious....
Suppose I have a form which has a table as its recordsource. I know that a
bound control will contain the value stored in the field to which it is
bound. But I've been fiddling around and it looks like I can make a direct
reference to the field itself to access the value in the field.
For example:
Table: tblStudent; Field: StudentLastName
I can place an unbound textbox ("txtStudentLastName") on the form, and
form's current event I can put the following code:
Me.txtStudentInfo= Forms!tblStudent.StudentLastname
Now, suppose I have a subform, based on a different recordset, without any
controls at all. The recordset has a field called "Age". I could put the
following code in the current event of the main form:
Me.txtStudentInfo=Forms!frmMain!frmSubform.form!Age
So, to me, it looks like you can pull the data directly from the
recordsource of the subform. I've always thought you needed to have a bound
control and then pull the data from that control. Is this correct? Have I
just been limited in my thinking? Does Access look for a control and not
finding one, then attempt to match a field in the underlying recordsource?
Also, I *think* that a form would have a collection of controls, right? So
would the fields of a recordsource somehow be some kind of a collection of a
form based on that recordsource?
Apologies if this is not clear...
Thanks!
Fred Boer
I posted this question a couple of days ago under the heading "Subform
reference returns value from query" (not a great subject heading, but I
couldn't think of anything better...), and got no answer, and I am still
curious....
Suppose I have a form which has a table as its recordsource. I know that a
bound control will contain the value stored in the field to which it is
bound. But I've been fiddling around and it looks like I can make a direct
reference to the field itself to access the value in the field.
For example:
Table: tblStudent; Field: StudentLastName
I can place an unbound textbox ("txtStudentLastName") on the form, and
form's current event I can put the following code:
Me.txtStudentInfo= Forms!tblStudent.StudentLastname
Now, suppose I have a subform, based on a different recordset, without any
controls at all. The recordset has a field called "Age". I could put the
following code in the current event of the main form:
Me.txtStudentInfo=Forms!frmMain!frmSubform.form!Age
So, to me, it looks like you can pull the data directly from the
recordsource of the subform. I've always thought you needed to have a bound
control and then pull the data from that control. Is this correct? Have I
just been limited in my thinking? Does Access look for a control and not
finding one, then attempt to match a field in the underlying recordsource?
Also, I *think* that a form would have a collection of controls, right? So
would the fields of a recordsource somehow be some kind of a collection of a
form based on that recordsource?
Apologies if this is not clear...
Thanks!
Fred Boer