Forms Displayed Side-by-Side

Paul Watts

Registered User.
Local time
Today, 10:07
Joined
Jan 19, 2011
Messages
47
Is there a way in which I can show 2 forms simultaneously, side-by-side. I want to be able to scan form 1 to find a suitable record then transfer some data from that record to another form/table. I then want to repeat this process several times.
 
You could set both your forms as Unbound Sub forms in a single main form.
 
You can adapt the following code as you need, but this gives the principles of what you want to do. Copy the following into a module:
Rem put this code in a module so it can be used by any form
Public Sub alignForms(pFormLeft As String, pFormRight As String)
Rem check that 'left' form is loaded
If SysCmd(acSysCmdGetObjectState, acForm, pFormLeft) = 0 Then Exit Sub
Rem check that the form is not in design view
If Forms(pFormLeft).CurrentView = 0 Then Exit Sub
Rem now calculate the required position of the right form relative to the left form
Dim lngTop As Long, lngLeft As Long
lngTop = Forms(pFormLeft).WindowTop
lngLeft = Forms(pFormLeft).WindowLeft + Forms(pFormLeft).WindowWidth
Rem use DoCmd.MoveSize to position the right form
DoCmd.MoveSize right:=lngLeft, Down:=lngTop
End Sub
... and copy this code into your form's Open event handleer:
Rem put this code in the form to be aligned with an open form
Rem the form you want to align with is identified by its name ("TargetForm" in this example)
Private Sub Form_Load()
alignForms "TargetForm", Me.Name
End Sub
 
Thanks John Big Booty. I will give this a try.

Paul :)

Thanks NickHa. I'm not yet into code so will try John's idea and get back to you if I'm struggling.

Paul :o
 
Apologies for digging up an old beast. With the code above I get a compile error: Expected variable or procedure, not module. My module is named alignForms. Have I made an error with the module name?
 
Make sure the module name and the method name are not the same. See if that makes a difference.
 

Users who are viewing this thread

Back
Top Bottom