value of a specific cell from a subform

Massoud

Registered User.
Local time
Today, 22:34
Joined
Jul 11, 2002
Messages
37
Hi experts,

I have a mainform in which there is a subform. Is there any way that I can retreive the value of the selected cell of the subform in the main form?
Currently what I usually do is that using a text box and setting it's control source to that special field in the subform, we have the value. But this is only for a specific field.
To explain my problem more precisely, I have a subform with 7 columns (fields) and 5 or 6 rows (datasheet view). When I click with the mouse on a specific cell ( or navigate within the subform with the arrow keys) I want to have the value of that cell in my main form.
Thanks in advance.
 
Put an unbound txtbox on your main form and reference the subform field using the following in the "Control Source":
=forms![yourmainforn]![yoursubform]!yourtxtbox
 
Thanks, but this is not what i'm looking for. In the subform when i move vertically (in a single field) the value of the unbound text box changes accordingly. But when I move horizantally in the subform (in different fields) I still want the value of the text box changed accordingly.
I hope this explanation makes it clear
 
Relational tables do not have "cells". They have rows and columns.

To do what you are asking requires code in the got focus event of every "horizontal" field.

fldA got focus event:
Me.Parent.UnboundFieldName = Me.fldA
fldB got focus event:
Me.Parent.UnboundFieldName = Me.fldB
fldC got focus event:
Me.Parent.UnboundFieldName = Me.fldC

etc.
 

Users who are viewing this thread

Back
Top Bottom