Command Button to Open another form

Posted on 2008-06-23
Last Modified: 2013-11-29
I have attached a screen shot with the relationships of the three tables that are included in my question.

So I have a Form 1 to enter data into the four Requirements Table fields (ID is an auto-gen number)
What I want is a command button on Form 1 that will close Form 1 then open and maximize Form 2.  In Form 2 I want to search through the People Table and find a record.  Then I want to be able to enter in several Roles via Form 2 that will create multiple entries into the Requirements People Table.  It should automatically enter in the ID that is autogenerated after creating a Requirement entry from Form 1, and it should automatically enter the unique Employee ID from the People record that you chose in Form 2.  It should enter these two things into the Requirements People Table for each role (different record) that is chosen.

So my questions are, what would be the VBA code for the command button on Form 1?
How can I set up Form 2 to accomplish this feat?
Question by:Michael2008
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Author Comment

ID: 21849726
Here is the file, forgot to attach it:
LVL 13

Accepted Solution

wiswalld earned 500 total points
ID: 21849760
DoCmd.Openform "Form2"
DoCmd.Close acForm, "Form1"

As for the other this is two seperate questions.
LVL 13

Assisted Solution

wiswalld earned 500 total points
ID: 21849770
In the on open for for2

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 13

Expert Comment

ID: 21849794
What table is form one based on? Will the unique number from form1 also be a unique number on form2?

Author Comment

ID: 21850153
Form 1 is based on the Requirements table, the fields that are entered are Section, Title, Applicability, and Description.  Then ID is simply and autogenerated integer, that is made once for each new data entry into the Requirements Table.  I created it that way so that I would have a primary key to like the Requirements table to the Requirements People table.  It will not be unique on Form 2, as there can be several different people linked with each requirement in various roles.  The Requirements People table has no primary key.  Let me know if you need any other clarifications, and thanks for the help.

Author Comment

ID: 21875651
Ok, since it is two seperate questions and there has been no responses for a while, I have decided to close this question.

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question