Acess VBA frames for layout control

Posted on 2006-05-17
Last Modified: 2008-02-01
Hello Experts,

I need to find the name of the "frame" control/container that can hold drawing elements used in my form layout.

I've tried a couple of things that hold objects, but none of them seem to hold simple drawing objects like rectangles and lines.

What I'm trying to accomplish is making a task pane on the right hand side of the form that stays on the right regardless of the resizing the user might do.  It would be much simpler to set my drawing elements and controls relative to a point on a container (say top left) and then position the container relative to the inside dimensions of the form.

If I have to, I can manually adjust each of the controls, but I shouldn't have to do such a thing.

The frame control/container
o must be able to contain simple drawing objects like rectangles as well as all of the controls one would put on a form.
o must be able to turn on and off (visible/invisible)
o must be resizeable (height & width) & repositionable (top & left)
o contained controls positioning (top & left) must be relative to the top & left of the containing control/collection.
o it would be really cool if the container could optionally have scrollbars to scroll the interior.
o useable with Using Access 2003 VBA

Anyway, that's what I'm looking for.

Another thought is using subforms (ugh!)

So, what control/container am I looking for?  Where do I find it?

Thanks y'all,
Question by:OuttaCyTE
    LVL 77

    Expert Comment

    Hi OuttaCyTE,

    Not in this universe, I don't think.
    Of course, it'll all be like that in Vista(:-)

    LVL 58

    Accepted Solution

    Hello OuttaCyTE

    There are two "containers" to choose from in your case.

    a) Tab Control (patially meets your requisites)

    A tab control with a single page, without tabs or buttons will have a "raised" border. You can however choose a "transparent" backstyle, in which case you can create your own border using  a rectangle.

    However, the positioning of objects is not relative to the container, nor does it provide scroll bars.

    b) Subform

    That totally fits your bill. If needed, the subform displayed in the subform control can share the same recordset, so that you can edit a single record accross the main form and the subform. However, remember that the record gets saved when entering or leaving the subform.

    Good luck!
    LVL 77

    Expert Comment

    Mmmm - I guess that's true- I read rather more into 'resizable' and 'repositionable' than the poster might have intended.


    Author Comment


    Tab control I didn't think of, but since the interior placement isn't relative to the container I'm no better off than an arbitrary reference point.

    I was afraid subform would be the way to go.  Not very elegant but there it is.

    Thanks a lot.

    Pete, thanks for responding.  The resizeable and repositionable would be under program control as a part of the form.
    LVL 58

    Expert Comment


    In fact, the only two "containers" – option groups and tab controls – are a problem when resizing a form, because you cannot "grab" all enclosed controls as you would in design view. So that moving and enclosed control can resize the container, and attempting to resize the container can silently fail. It's really hard to manage.

    Your aim, "making a task pane on the right hand side of the form", it best done with a subform, and I also think it's elegant. For example, the tab cycle is independant (like on a form footer), there is an independant control focus (setting the focus back to the main form reactivates the last control), the main form's current event doesn't create conflicts (you can have auto-repeat  buttons), there is an independant class module (easier to document and maintain), and you have independant form events, although you can still trap any of the main form's events using "withevents" variable... In some cases, the subform is reusable on different forms, as well.

    It took me a while, but I now use non-data subforms quite a lot: custom embedded "toolbar", custom navigation buttons, fake calendar control and other missing controls, side menus, logos, etc.

    It seems I reacted strongly to "not very elegant"... ;)
    Good luck with your project!

    Author Comment

    Snowy Owl, you see clearly!

    I can see where the re-usability can be very attractive.  Since your prior response I've been thinking about the ability to re-use the subform in other forms.  Something I handn't considered before.

    You make a strong case for subforms.

    Anyway, thanks for your responses,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now