Question:
How do I call a form from another form using a command button?
Answer:
You can put code into the Click event of the command button that executes a DO FORM command that will bring up the form you want. For example:
- Create a form called ParentForm by executing the following command in the Command Window:
MODIFY FORM ParentForm
- Add a command button to this form and put the following code into the Click event of the command button:
DO FORM ChildForm
- Set the caption of the form to “Parent.”
- Save the form.
- Create a form called ChildForm by executing the following command in the Command Window:
MODIFY FORM ChildForm
- Set the caption of the form to “Child.”
- Save the form.
- Execute the following command from the Command Window:
DO FORM ParentForm
- Click on the command button. You should see the Child form come up.