Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

*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.


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

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

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?


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

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

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

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

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

Ok. Any idea why the subform moves? Im just trying to switch the graph on the main form "Home" on the Northwind 2007 db.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!


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