Have forms B, C and D open in a specific location in relation to A.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scrapcode
    New Member
    • Apr 2010
    • 26

    #1

    Have forms B, C and D open in a specific location in relation to A.

    Hi guys. Firstly I would like to say I have used the site for a while now and it's great, this is the first time I've had to ask a new question.

    I have a form A, and within that form I have a frame. There is also a command button on A that will open B. There is a button on B that opens C and so on. My problem is that I am trying to code forms B, C, D, E and all the rest to open in the frame on form A, wherever that form is. I say that because I played with saving the other forms over the location I wanted, and when they opened it seemed to work, but whenever form A was moved the effect was obviously lost.

    I'm working with Visual Basic in Access 2003. Any help would be greatly appreciated.

    Thanks!
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Well considering that you are working with Visual Basic for Applications (VBA) from within M$ Access which is probably version 6.5 and NOT Visual Basic 6.0... That and you have not shown us the code you presently use that "seems" to work unless the form "A" is moved... You make it really hard for us to help you...

    Comment

    • scrapcode
      New Member
      • Apr 2010
      • 26

      #3
      My appologies for not being clear enough and for my lack of response.

      There is no code for my "almost solution". What I meant is that when you save and close down the form it will reopen in the same location. What I was doing was saving the first form (A) in a set place, then saving (B), (C) and so on so they are over the frame in (A). This only works until someone moves form (A) then the next forms are out of place. I'm sorry I can't show you any code, because its the code that I need. Is there a line of code that will tell a loading form to open in specific cordinates of an existing form.

      So (A) is open, you press a command button to open (B)and on load (B) opens within the coordinates of the frame placed on form (A).

      Is that any clearer?

      Comment

      • vb5prgrmr
        Recognized Expert Contributor
        • Oct 2009
        • 305

        #4
        Okay,... here is how I would do something like this in vb6...
        Code:
        Option Explicit
        
        Sub Main()
        Load Form1
        Form1.Move 0, 0
        Load Form2
        Form2.Move Form1.Left + Form1.Width, 0
        Load Form3
        Form3.Move 0, Form1.Top + Form1.Height
        Load Form4
        Form4.Move Form1.Left + Form1.Width, Form1.Top + Form1.Height
        Form1.Show
        Form2.Show
        Form3.Show
        Form4.Show
        End Sub
        What the above does is to set Form1's left and top at zero so it would be in the upper left portion of the screen. Then based off of that I set the other three forms based on its height and width. Now, if it is not obvious to you, these 4 forms are the same height and width so it was easy. If your forms are of different sizes, then you will have to compensate for that.



        Good Luck

        Comment

        Working...