updating a text box by clicking a subform record

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

Guest

Hi,

ive created a form with 2 text boxes and a subform. the users use the
subform to scroll through the records.

what i want is to be able to click on a record in the subform and have the
values for that record appear in the two text boxes.

my text box names are Unit and Establishment. Each record is the subform is
made up of a Unit and and Establishment (represented by a number).. is there
an easy solution.

grateful for any assistance...

regards, Paul
 
paul said:
ive created a form with 2 text boxes and a subform. the users use the
subform to scroll through the records.

what i want is to be able to click on a record in the subform and have the
values for that record appear in the two text boxes.

my text box names are Unit and Establishment. Each record is the subform is
made up of a Unit and and Establishment (represented by a number).. is there
an easy solution.

Very easy. Just set the main form text boxes to refer to
the subform text boxes:

=subformcontrolname.Form.unittextbox
 
Marshall, thanks for your help. i forgot to mention that my subform is in
datasheet view, will your solution still work..

also i dont know how to set the main form text box to :

=subformcontrolname.Form.unittextbox

where do i put this peice of code. is the =subformcontrolname the name of
my subform?

is the next part .form the form name on which the subform sits?

grateful for any assistance...

Paul
 
Yes, it will work in sheet view. Whichever record you
navigate to (by whatever means) in the subform (in any view)
will be the subform's current record. Any reference to a
control in the subform will retrieve the value from the
current record.

The expression (not a piece of code) can be placed in the
text box's ControlSource property. You can display an
object's property sheet by using numerous means, most
obvious is through the View menu.

subformcontrolname is the name of the subform control on the
main form. This control will display the form object that
you're using inside another form. Its Name property can be
seen in its property sheet. The name of the form it will
display is in its SourceObject property. Don't confuse the
control's name and the form's name, they may or may not be
the same.

The Form property should be entered as Form, it is not
replaced by anything. The Form property returns the form
object currently displayed in the subform control. Until
you tell us what names you are actually using, I write the
words you do not replace with a capital and the ones you do
replace with the names of items you created in all lower
case. Other folks use other notational mechanisms, some
don't attempt to make a distinction and rely on the reader
to know which is which so you have to be flexible is reading
replies to your questions.
 
Back
Top