Read value from subform

  • Thread starter A.J.M. van Rijthoven
  • Start date
A

A.J.M. van Rijthoven

I have a form (net) with a subform(foto) with the field fotolocatie
The data in this field contains the directory and name of a
photograph, linked to the database.
On this subform is also a button so that I can print out the
photograph.
When the button is clicked, it opens a new form. The title of this
form is data that is taken from the mainform(net). That's no problem
But the data for loading the picture must be taken from the
fotolocatie-field on the subform.
Me.fotoafbeelding.Picture = Forms!frmfoto.fotolocatie

MSAccess gives an error that it can't find the subform.
What is the solution for this problem??
 
A

adsl

A.J.M. van Rijthoven said:
I have a form (net) with a subform(foto) with the field fotolocatie
The data in this field contains the directory and name of a
photograph, linked to the database.
On this subform is also a button so that I can print out the
photograph.
When the button is clicked, it opens a new form. The title of this
form is data that is taken from the mainform(net). That's no problem
But the data for loading the picture must be taken from the
fotolocatie-field on the subform.
Me.fotoafbeelding.Picture = Forms!frmfoto.fotolocatie

MSAccess gives an error that it can't find the subform.
What is the solution for this problem??
 
A

adsl

A.J.M. van Rijthoven said:
I have a form (net) with a subform(foto) with the field fotolocatie
The data in this field contains the directory and name of a
photograph, linked to the database.
On this subform is also a button so that I can print out the
photograph.
When the button is clicked, it opens a new form. The title of this
form is data that is taken from the mainform(net). That's no problem
But the data for loading the picture must be taken from the
fotolocatie-field on the subform.
Me.fotoafbeelding.Picture = Forms!frmfoto.fotolocatie

MSAccess gives an error that it can't find the subform.
What is the solution for this problem??
 
A

adsl

A.J.M. van Rijthoven said:
I have a form (net) with a subform(foto) with the field fotolocatie
The data in this field contains the directory and name of a
photograph, linked to the database.
On this subform is also a button so that I can print out the
photograph.
When the button is clicked, it opens a new form. The title of this
form is data that is taken from the mainform(net). That's no problem
But the data for loading the picture must be taken from the
fotolocatie-field on the subform.
Me.fotoafbeelding.Picture = Forms!frmfoto.fotolocatie

MSAccess gives an error that it can't find the subform.
What is the solution for this problem??
 
G

Guest

Try including the main form in the statement....

Me.fotoafbeelding.Picture = Forms!frmNet!frmfoto.fotolocatie
 
J

John Vinson

When the button is clicked, it opens a new form. The title of this
form is data that is taken from the mainform(net). That's no problem
But the data for loading the picture must be taken from the
fotolocatie-field on the subform.
Me.fotoafbeelding.Picture = Forms!frmfoto.fotolocatie

MSAccess gives an error that it can't find the subform.
What is the solution for this problem??

A Subform is not open in its own right, and is not part of the Forms
collection. To refer to a field on the subform you must go through the
main form, and use the name of the Subform Control on the mainform -
this might be different than the name of the form *within* that
subform control. The syntax (if I understand your form names
correctly) would be

= [Forms]![net]![frmfoto].Form![fotolocatie]

If the Subform control is named subFoto or Foto (or whatever), use
that name instead of frmfoto.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top