Pulling from a record into a text box...

TomJamieson

Registered User.
Local time
Today, 19:05
Joined
Jun 8, 2006
Messages
50
I've made the form below, with a sub form in it to show the table below the text boxes. What I'd like, is for the user to be able to select a record on the table (preferably just by clicking on it) and the text boxes to automatically populate with the relevent data. Is there a way to do this?

frm.jpg
 
I am assuming that the datasheet form in your example is on the form as control (sub form) and that the controls in the main form are unbound.

Code:
Me.Parent.[COLOR="Blue"]Name of the control on the main form[/COLOR] = Me.[COLOR="Blue"]Name of the control on the subform[/COLOR].

e.g

Code:
Me.Parent.[COLOR="Blue"]txtCustomerNameResult[/COLOR] = Me.[COLOR="Blue"]CustomerName[/COLOR]

Put the code in the OnClick event of the subform.

If you have a problem post back and I will post a sample.
 
Thanks, I think that makes sense to me. The table is a subform, and under the event tab I only have the choice of On Enter or On Exit. There is no On Click...?
 
Have a look at the attached sample, I have given you 2 methods;

1 With a Main form with subform in datasheet format
2 Normal continious form

Open the form frmCusGeneric in design view. Select properites from the view menu, then event and then go down until to come to OnClick select the three ... and you will see the small bit of code that makes it work. You can do the same for the form sfrmCusGenericDS.
 

Attachments

Users who are viewing this thread

Back
Top Bottom