Unbound Mainform, Unbound datasheet Subform data to a textbox (1 Viewer)

Hudas

Registered User.
Local time
Yesterday, 16:17
Joined
May 13, 2013
Messages
55
Hello!

I need help!.. I have an unbound mainform and an unbound subform(datasheet). The source of the subform is a query which is dynamic(I have many queries with diffrent columns). the subform source is change using a combo box selection. I have text boxes in my mainform... my question is how do I get the data from subform to the text boxes of the mainform?

Thank you
hudas
 

Mihail

Registered User.
Local time
Today, 02:17
Joined
Jan 22, 2011
Messages
2,373
VBA:
Use the "OnClick" event for the combo.

Code:
Private Sub ComboName_Click()
   Me.SubformName.Rowsource = ComboName.Text
   Me.SubformName.Requery
End Sub
Note that this code is not tested but for sure is very close to your needs.
 

Mihail

Registered User.
Local time
Today, 02:17
Joined
Jan 22, 2011
Messages
2,373
I forgot to say that this is not the right way to do your job.
Learn about queries with parameters and use such a query as rowsource for your subform
 

Users who are viewing this thread

Top Bottom