getting values from form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I perform filter on subform.
After filtering I want to append values from column of subform to another
table.

This code is not working :

DoCmd.RunSQL "INSERT INTO [Tissues for RNAs] ([Tissue ID])
VALUES(Forms![Browse All Tissues]![Tissue ID])"

The problem is to get values from column in subform.

Thanks in advance.
 
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" is a good
overview of how to refer to controls on subforms.

An important thing to realize, though, is that when it refers to "Subform1"
or "Subform2" in that chart, it's referring to the name of the subform
control on the parent form, which may or may not be the same as the name of
the form being used as the subform.
 
I tryed to follow the instructions, but I get run-time error 2764 (the
expression you entered refers to an object that closed or doesn't exist):

"INSERT INTO [Tissues for RNAs] ([Tissue ID]) VALUES(" & Me![Browse All
Tissues].Form![Tissue ID] & ")"

and another option that i tryed is also problematic:

"INSERT INTO [Tissues for RNAs] ([Tissue ID]) VALUES(Forms![Browse All
Tissues].[Tissue ID])"

I checks the name of subforms and forms.
What else can I do?

Douglas J. Steele said:
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" is a good
overview of how to refer to controls on subforms.

An important thing to realize, though, is that when it refers to "Subform1"
or "Subform2" in that chart, it's referring to the name of the subform
control on the parent form, which may or may not be the same as the name of
the form being used as the subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


lena said:
Hi,

I perform filter on subform.
After filtering I want to append values from column of subform to another
table.

This code is not working :

DoCmd.RunSQL "INSERT INTO [Tissues for RNAs] ([Tissue ID])
VALUES(Forms![Browse All Tissues]![Tissue ID])"

The problem is to get values from column in subform.

Thanks in advance.
 
Where are you running the code from: the parent form, or the subform?

If it's from the subform, you should be able to use simply Me![Tissue ID]

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


lena said:
I tryed to follow the instructions, but I get run-time error 2764 (the
expression you entered refers to an object that closed or doesn't exist):

"INSERT INTO [Tissues for RNAs] ([Tissue ID]) VALUES(" & Me![Browse All
Tissues].Form![Tissue ID] & ")"

and another option that i tryed is also problematic:

"INSERT INTO [Tissues for RNAs] ([Tissue ID]) VALUES(Forms![Browse All
Tissues].[Tissue ID])"

I checks the name of subforms and forms.
What else can I do?

Douglas J. Steele said:
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" is a
good
overview of how to refer to controls on subforms.

An important thing to realize, though, is that when it refers to
"Subform1"
or "Subform2" in that chart, it's referring to the name of the subform
control on the parent form, which may or may not be the same as the name
of
the form being used as the subform.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


lena said:
Hi,

I perform filter on subform.
After filtering I want to append values from column of subform to
another
table.

This code is not working :

DoCmd.RunSQL "INSERT INTO [Tissues for RNAs] ([Tissue ID])
VALUES(Forms![Browse All Tissues]![Tissue ID])"

The problem is to get values from column in subform.

Thanks in advance.
 
Back
Top