Might be asking the impossible...

billythedj66

Board Regular
Joined
Jan 6, 2003
Messages
126
Here is what I would like to do; While in a form (Form A), I want to create a macro for a button that when clicked, will close (Form A), and open (Form B) to enter data. Then when closed with another button, closes (Form B) then opens (Form A) at the original record. I am not sure if that makes any sense at all - if more information is needed please ask.

Bill
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi Bill,

You can use following method:

In click event of the command button on A form, you can put the following code:

Code:
Private Sub cmdAFormButton_Click()
  Me.Visible = False 'Hide form A
  DoCmd.OpenForm "B", acNormal, , , , acDialog 'Show form B, but use acDialog value so next line will be executed only when B form is closed
  Me.Visible = True  'B form is closed. Show me.
End Sub

For B form command button, you just need a close procedure.

Code:
Private Sub cmdBFormButton_Click()
  Docmd.close
End Sub

Record won't be changed in A form because we don't remove it from the memory, just hide it.

I hope this helps.

Suat
 
Upvote 0

Forum statistics

Threads
1,221,838
Messages
6,162,286
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top