Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

How do I? : Control Positioning of Subform when switching?

thefarg (Programmer) (OP)
29 Jan 12 15:12
I have a form with a subform frame in it. Using


Me.MySubformFrame.Form = "MySubForm1"
works but the subform open outside of the frame. Top left corner in fact. Any ideas on why this is happening and how I can solve it?

thefarg (Programmer) (OP)
29 Jan 12 15:45
Currently, Im using the following code as a workaround.


Dim SubformTop As String
Dim SubformLeft As String
SubformLeft = sbfSalesPivot.Left
SubformTop = sbfSalesPivot.Top

            Me.sbfSalesPivot.Form.Visible = False
            Me.sbfSalesPivot.SourceObject = "frmHome_SalesAnalysisSubform4"
            sbfSalesPivot.Top = SubformTop
            sbfSalesPivot.Left = SubformLeft
            Me.sbfSalesPivot.Form.Visible = True
It appears to work fine, but its a messy way to do it. Can anyone help with the problem of the subform escaping its frame?
            sldGraph.Tag = 4
dhookom (Programmer)
29 Jan 12 23:19
Again unconventional request without providing context. I have never heard of a subform changing Top and Left properties without code changing them.

I would expect you should be using:


Me.MySubformFrame.SourceObject = "MySubForm1"
The top and left properties are numeric, not strings. Try to conform like:


Dim lngSubformTop As Long
Dim lngSubformLeft As Long
lngSubformLeft = Me.sbfSalesPivot.Left
lngSubformTop = Me.sbfSalesPivot.Top

Hook'D on Access
MS Access MVP

thefarg (Programmer) (OP)
30 Jan 12 18:18
Ok. Any idea why the subform moves? Im just trying to switch the graph on the main form "Home" on the Northwind 2007 db.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close