VBA Open form as message will open another form

Ronald Malk
Ronald Malk used Ask the Experts™
on
Hi every one, I don’t know if it can be done, I have a Form " FrmMg " I use it as a pop  up message, what I need is  to be able for the user when click the word (HERE) another form gets opened.

DoCmd.OpenForm " FrmMg "
Forms!FrmMg.TxAA.Value = "Select a Customer From The List OR click (HERE) to enter a new Customer “
I know I can have readymade form with control contain the word “HERE” linked to the other form,  but I’m trying to use same message form for many different scenarios,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Is it a normal or modal pop-up? In the first case you can use DoCmd.OpenForm to open a further form.

But pop-up over pop-uip form is bad UI and user experience. Can you give use more context for a probably better approach?

When you want to resuse a form and open it multiple times in parallel, then you cannot use DoCmd.OpenForm. In this case you need to create an new instance of the form in VBA, e.g.

Dim newForm As Form_FrmMg
Set newForm = New Form_Mg

Open in new window


But again: more context and a concise and complete sample would be helpful for us to better help you.
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
Set a variable holding the form name, say, "NewCustomer":

FormToOpen = "NewCustomer" ' or other form name.
Forms!FrmMg.TxAA.Value = "Select a Customer From The List OR click (" & FormToOpen & ") to enter a new Customer."

Open in new window

Author

Commented:
Sorry,I may have had to say I'm not a real programmer, if you please  I would need the complete code
Distinguished Expert 2017
Commented:
You cannot embed a hyperlink inside a text string.  Just change the message so instead of press "here", it says press "button2" and add a button to open the second form.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial