By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Link command button to subform

P: 2
Okay so let me preface this question by saying I am a very competent novice microsoft access 2010 user (I have Msft Access 2010 on my computer). I understand basic access concepts and database setup but that's where it ends so if an answer could be given as if I knew nearly nothing that would be much appreciated.

The issue:

I have an existing database I am trying to build for my landscaping business. I have a main form called "Landscaping Customer Information" that I want to have accompanied by several subforms. I am aware of how to create a subform within a main form and link the primary key to the foreign key, etc.

WHAT I AM STRUGGLING TO FIGURE OUT IS: Instead of having all of these subforms directly on the main form (and instead of having tabs for each of the subforms), how can I add command buttons to open the subforms such that each subform is only opening the data specific to the particular primary key (eg: landscaping customer information ID) AND ALSO auto-fills the specific primary key from the main form into the foreign key field?

Said differently, here's a specific example. Main form is named "Customers". Primary key is set to autonumber and is "Customers Id". One of the subforms is named "Customer tasks completed". Primary Key is set to autonumber and is "customer tasks completed id". Foreign Key is set to number and is "customers id". I would like a command button that opens the subform "customer tasks completed" and depending on which "customers" entry it is opened in, it would autofill that specific "customers id" into the foreign key set as "customers id".

For the life of me I cannot find a solution to this that is both practical and that I understand as a more basic user. Any help is hugely appreciated, thanks in advance!
Jan 23 '17 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,221
DoCmd.Openform has a parameter for a where string, so that you can open a form and control the data that is shown in the form's recordset.
Jan 24 '17 #2

P: 2
Thank you for your reply. Pretend I know nothing. How would I go about implementing this advice step-by-step? I don't have any coding experience.
Jan 26 '17 #3

Post your reply

Sign in to post your reply or Sign up for a free account.