By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,224 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,224 IT Pros & Developers. It's quick & easy.

Refer to several tab pages

P: 2
Hi!
Im working in a database in Microsoft Office Access 2003 with Microsoft Visual Basic 6.5. I have 8 Tabs in a form.

Im just wondering if there is a better way to reduce this lines:
Expand|Select|Wrap|Line Numbers
  1. ChildTop = 3100
  2. ChildLeft = 9000
  3. ChildWidth = 8000
  4. ChildHeight = 5200
  5. Me.Page1Child.Top = ChildTop
  6. Me.Page1Child.Left = ChildLeft
  7. Me.Page1Child.Width = ChildWidth
  8. Me.Page1Child.Height = ChildHeight
  9. Me.Page2Child.Top = ChildTop
  10. Me.Page2Child.Left = ChildLeft
  11. Me.Page2Child.Width = ChildWidth
  12. Me.Page2Child.Height = ChildHeight
  13. Me.Page3Child.Top = ChildTop
  14. Me.Page3Child.Left = ChildLeft
  15. Me.Page3Child.Width = ChildWidth
  16. Me.Page3Child.Height = ChildHeight
  17. Me.Page4Child.Top = ChildTop
  18. ...
Oct 10 '08 #1
Share this Question
Share on Google+
5 Replies


DonRayner
Expert 100+
P: 489
You would be better off taking this question over to the Visual Basic Form.
Oct 10 '08 #2

NeoPa
Expert Mod 15k+
P: 31,707
I'm not sure Don.

This is presumably a VBA form object we're talking about.

The answer rather depends on there being some sort of pages collection. Let me see what I can find.
Oct 12 '08 #3

NeoPa
Expert Mod 15k+
P: 31,707
Try this :
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2.  
  3. ChildTop = 3100
  4. ChildLeft = 9000
  5. ChildWidth = 8000
  6. ChildHeight = 5200
  7.  
  8. For Each ctl In Me.Controls
  9.   If ctl.ControlType = 124 Then
  10.     ctl.Top = ChildTop
  11.     ctl.Left = ChildLeft
  12.     ctl.Width = ChildWidth
  13.     ctl.Height = ChildHeight
  14.   End If
  15. Next ctl
The ControlType value of 124 indicates a Page control of course.
Oct 12 '08 #4

DonRayner
Expert 100+
P: 489
I'm not sure Don.

This is presumably a VBA form object we're talking about.

The answer rather depends on there being some sort of pages collection. Let me see what I can find.
Sorry about that NeoPa, it's just that I find that much of what works in VBA doesn't translate quite as you think it should over to Visual Baisc 6.

Don
Oct 13 '08 #5

NeoPa
Expert Mod 15k+
P: 31,707
No apology necessary Don. It wasn't too clear - although the OP obviously did their best to be specific.

My solution will probably only work for an Access form. If it turns out to be a VB one, then they'll need to follow your advice anyway ;)
Oct 13 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.