Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

thefarg

Programmer
Jan 25, 2012
94
NZ
I have a form with a subform frame in it. Using
Code:
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?

Thanks
Mike
 
Currently, Im using the following code as a workaround.
Code:
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
 
thefarg,
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:
Code:
Me.MySubformFrame.SourceObject = "MySubForm1"
The top and left properties are numeric, not strings. Try to conform like:
Code:
Dim lngSubformTop As Long
Dim lngSubformLeft As Long
lngSubformLeft = Me.sbfSalesPivot.Left
lngSubformTop = Me.sbfSalesPivot.Top

Duane
Hook'D on Access
MS Access MVP
 
Ok. Any idea why the subform moves? Im just trying to switch the graph on the main form "Home" on the Northwind 2007 db.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top