Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Link to txtbox on AfterUpdate

Status
Not open for further replies.

pmkieffe

Technical User
Jun 12, 2006
32
ID
Hi,

Can someone help me with linking a subform in datasheet view to a textbox in the mainform? I have a primary key called EmployeeID. The text box in the main form displays the EmployeeID, and I was thinking of building an AfterUpdate code to then link the textbox EmployeeID number to the subform based on a query with EmployeeID as one of its fields. Is this possible? Could someone please help me build the code?

Thank You,
pmkieffe
 
Why do you need an "AfterUpdate code to then link" a datasheet subform?

Just create your subform and have the Default View.....Datasheet

Your Subform:
Source Object: Query
Link Child Fields.... EmployeeID
Link Master Field.... EmployeedID
 
Thanks ssatech,

I had it set up like that, but my problem was that it did not immediately link. I would select an EmployeeID in the main form then I would have to scroll off of the ID then back on it for the subform to be updated. I would like the subform to read the EmployeeID as soon as I select it in the main form. Any suggestions for this? Or did I have it set up wrong as far as your suggestion?

Thanks,
pmkieffe
 
had it set up like that, but my problem was that it did not immediately link."
I don't understand if your tables, relationship and query is correct it should work. Perhaps, I did not understand your original post.

You have your subform based on query AND do you have EmployeeID in it? Add it to your Datasheet subform, at the bottom of the Form Footer. Then just establish the link between the Main Form and the Subform:

Your Subform:
Source Object: Query
Link Child Fields.... EmployeeID
Link Master Field.... EmployeedID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top