Opening multiple forms in one window

hiwelcome

Registered User.
Local time
Yesterday, 16:17
Joined
Aug 14, 2015
Messages
47
I have a button that opens two separate forms when clicked. I have them set to pop up, but is it possible to have them pop up in the same window in a tabbed or similar format instead of in two separate windows?
 
can you clarify what you mean - a popup is a window in its own right - perhaps include a screenshot.

Or perhaps you require a mainform with two subforms
 
I will try. Two different forms pop up for data entry after the button is used. So two windows open, one with frmX and one with frmY. I would like both of those forms to open in one window. Is this possible?

I considered the subform idea, but it would be much more work. So before I went that route I thought I'd check for this possibility first.
 
I considered the subform idea, but it would be much more work.

How so? Putting them on an empty main form hardly seems an onerous task.

You can use V-tools to find every reference to them and adjust accordingly.
 
I would like both of those forms to open in one window. Is this possible?
As explained, a form is a window in its own right so the answer is it is not possible.

The only way is a form with two subforms
 
How so? Putting them on an empty main form hardly seems an onerous task.

You can use V-tools to find every reference to them and adjust accordingly.


Because the user will have about 10 different choices for frmX and 17 different choices for frmY. Wouldn't that mean that I would have to make 170 of them? (Yes, it is quite possibly not designed ideally, but the company is beyond that point)
 
As explained, a form is a window in its own right so the answer is it is not possible.

The only way is a form with two subforms

Very well, I'll look into other options then. Thank you.
 
Because the user will have about 10 different choices for frmX and 17 different choices for frmY. Wouldn't that mean that I would have to make 170 of them?

No. You can use one form and assign the SourceObject property of the subformcontrols dynamically.

This could be done by passing the names of the subforms in the Openargs argument of the OpenForm command.
 
I really have no idea how to even begin doing that (Access noob). Can you give me a link to read up on it or give me some tips?
 
Rough demo attached. Open the Master form.

It just loads the two subforms one way or the other but the technique can be used to load any subform. Just put the form names in the OpenArgs parameter of the OpenForm command.
 

Attachments

Thank you very much for the demo. This is great. Much appreciated Galaxiom.
 
Galaxiom or anyone else, can you help with tab order? I need the user to be able to tab from the last field of one form to the first field of the second. I am familiar with using setfocus, but unsure how to apply that when the two form names can be different each time depending on user choice.
 
I am familiar with using setfocus, but unsure how to apply that when the two form names can be different each time depending on user choice.
formname is not really an issue - to refer to a control in another subform from a subform you would use

Parent.2ndSubformName.Form.controlname

Your problem is going to be knowing the name of the control on the second subform
 
I am trying it just to test it and it's not giving me an error, but it's not working either...it just goes back to the first field of the first subform.

Private Sub TextComments_LostFocus()
Parent.FormB.Form.TextReg1.SetFocus
End Sub

TextComments is the last field on Subform 1, TextReg1 is the first field on Subform 2. FormB is the name of Subform 2. What do I have wrong?
 
Rather than Lost Focus I would use KeyDown to detect the Tab or Enter keys on the last control of the first form.

The first control on the second form could be found by using a consistent name, Alternatively it could be designated by a custom Property of the forms. The later technique would be my preference.
 
First, thank you CJ - apparently I did need two setfocus lines. Galaxiom, I think I agree with using KeyDown, but I am having the same problem as the gentleman from the post below, except I'm not sure how to solve it as he did:



(http://www.access-programmers.co.uk/forums/showthread.php?t=247958)




Bit of an update. Tried SetFocus to the second field on the second subform. All this did was make it SetFocus to the third field...

Also tried setting "ScreenSize(CD12)" to TabIndex = 0 - even though it already is - but still produces the same result.

The way I had to fix this was that I first realized I had put a box inside the second subform because of a SetFocus I had before with it. The field did not allow a Tab stop. I replaced "ScreenSize(CD12)" with that field and now it works perfectly!

Thanks for all the help! Much appreciated!




My code is also setting focus to the second field instead of the first. Do you know what he means in his fix above, or how I can fix mine?
 

Users who are viewing this thread

Back
Top Bottom