Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetParent and Scroll

25 views
Skip to first unread message

Peter T

unread,
Apr 21, 2013, 5:34:19 AM4/21/13
to
This concerns VBA but I know of no better place to ask, I hope!

I want to place a Userform on an Access form which is easily done with
SetWindow. The Access form can have scrollbars which in turn move objects on
the form in the normal way - but the userform stays in the same visible
position, ie cannot scroll it in/out of site. Also the userform flickers
while attempting to scroll.

So how to place the Userform window on the Access form's window such that it
behaves like an object that moves with the Access form's scrollbars?

TIA,
Peter T

Auric__

unread,
Apr 21, 2013, 7:46:41 AM4/21/13
to
Peter T wrote:

> This concerns VBA but I know of no better place to ask, I hope!

You could try one of the microsoft.public.access.* groups, or you could just
ask in microsoft.public.office.developer.vba -- but here works fine too.

(I can't answer your actual question, though.)

--
My pet badger needs a lover. Can I introduce you two?

Peter T

unread,
Apr 21, 2013, 10:21:00 AM4/21/13
to
"Auric__" <not.m...@email.address> wrote in message
> Peter T wrote:
>
>> This concerns VBA but I know of no better place to ask, I hope!
>
> You could try one of the microsoft.public.access.* groups, or you could
> just
> ask in microsoft.public.office.developer.vba -- but here works fine too.
>
> (I can't answer your actual question, though.)

I tried searching various Access groups but couldn't see anything related.
Access has it's own forms and controls and it'd be unusual to want to
"embed" a userform on an Access form.

I'm hoping there might be a generic Windows/API solution, though wouldn't
want to get involved in say hooks or sub-classing.

Peter T

MikeB

unread,
Apr 21, 2013, 1:26:32 PM4/21/13
to

"Peter T" <pet...@discussions.com> wrote in message
news:kl0sek$fjh$1...@dont-email.me...
> "Auric__" <not.m...@email.address> wrote in message
>> Peter T wrote:
>>
>>> This concerns VBA but I know of no better place to ask, I hope!
>>
>> You could try one of the microsoft.public.access.* groups, or you could
>> just
>> ask in microsoft.public.office.developer.vba -- but here works fine too.
>>
>> (I can't answer your actual question, though.)
>
> I tried searching various Access groups but couldn't see anything related.
> Access has it's own forms and controls and it'd be unusual to want to
> "embed" a userform on an Access form.

What happens if you put it inside a container, like a Panel?

Peter T

unread,
Apr 21, 2013, 6:14:46 PM4/21/13
to

"MikeB" <m.by...@frontier.com> wrote in message
news:kl17ah$1os$1...@dont-email.me...
>
> What happens if you put it inside a container, like a Panel?

A Panel? ah, a "SubForm". I haven't put it all together yet but that seems
to be the way.

Thanks!
Peter T

Jeff Johnson

unread,
Apr 22, 2013, 2:18:04 PM4/22/13
to
"Peter T" <pet...@discussions.com> wrote in message
news:kl1o6v$7bm$1...@dont-email.me...

>> What happens if you put it inside a container, like a Panel?
>
> A Panel? ah, a "SubForm". I haven't put it all together yet but that seems
> to be the way.

By which I hope you mean that you're dropping the idea of working with a
UserForm when Access has its own forms engine.


Peter T

unread,
Apr 22, 2013, 5:56:13 PM4/22/13
to

"Jeff Johnson" <i....@enough.spam> wrote in message
news:kl3un6$cji$1...@dont-email.me...
Not at all! Reason is controls can't be created at runtime on Access forms
(design time only with CreateControl) whereas they can on Userforms with
Controls.Add

Peter T

Tony Toews

unread,
Apr 28, 2013, 4:29:10 PM4/28/13
to
On Mon, 22 Apr 2013 22:56:13 +0100, "Peter T"
<pet...@discussions.com> wrote:

>Reason is controls can't be created at runtime on Access forms
>(design time only with CreateControl) whereas they can on Userforms with
>Controls.Add

Create sufficient controls ahead of time but make them not visible.
Make them visible and position them as required.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

GS

unread,
Apr 28, 2013, 9:33:26 PM4/28/13
to
I know absolutely nothing about Access Forms, but if they support a
listbox then if all you need is the ability to create optional
menuitems at runtime the use a listbox and query the index or text in a
Select Case construct to determine which process to run via the
listbox's click event.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Peter T

unread,
May 1, 2013, 2:51:21 PM5/1/13
to
"Tony Toews" <tto...@telusplanet.net> wrote in message
> On Mon, 22 Apr 2013 22:56:13 +0100, "Peter T"
> <pet...@discussions.com> wrote:
>
>>Reason is controls can't be created at runtime on Access forms
>>(design time only with CreateControl) whereas they can on Userforms with
>>Controls.Add
>
> Create sufficient controls ahead of time but make them not visible.
> Make them visible and position them as required.

That wouldn't be viable, potentially a *lot* of controls might be needed.
But adding controls to a userform on a subform as required is working fine.
But thanks for the suggestion.

Peter T

Peter T

unread,
May 1, 2013, 3:04:25 PM5/1/13
to
"GS" <g...@somewhere.net> wrote in message

>I know absolutely nothing about Access Forms, but if they support a listbox
>then if all you need is the ability to create optional menuitems at runtime
>the use a listbox and query the index or text in a Select Case construct to
>determine which process to run via the listbox's click event.

Access forms have equivalents to most (though not all) Userform controls,
including a Listbox. But a Listbox of any type wouldn't help.

The ideal solution would be to add a MSForm Frame as an aX to an Access form
and add controls to that. That works but is all much slower.

There's are a lot of nice things about Access forms, not sure why Userforms
or even VB6 forms weren't updated similarly. OTH Access forms lack some
important things which is also odd.

Peter T

GS

unread,
May 1, 2013, 4:27:28 PM5/1/13
to
It was my intent to address the slowness issue. Using a listbox for
user actions will process much faster, and without the added overhead
of using a container plus multiple controls! Not to mention the entry
point for all user actions is in one event, making code easier to
manage/maintain IMO!<g>

Peter T

unread,
May 1, 2013, 5:08:43 PM5/1/13
to
"GS" <g...@somewhere.net> wrote in message
>> "GS" <g...@somewhere.net> wrote in message
>>
>>>I know absolutely nothing about Access Forms, but if they support a
>>>listbox then if all you need is the ability to create optional menuitems
>>>at runtime the use a listbox and query the index or text in a Select Case
>>>construct to determine which process to run via the listbox's click
>>>event.
>>
>> Access forms have equivalents to most (though not all) Userform controls,
>> including a Listbox. But a Listbox of any type wouldn't help.
>>
>> The ideal solution would be to add a MSForm Frame as an aX to an Access
>> form and add controls to that. That works but is all much slower.
>>
>> There's are a lot of nice things about Access forms, not sure why
>> Userforms or even VB6 forms weren't updated similarly. OTH Access forms
>> lack some important things which is also odd.
>>
>> Peter T
>
> It was my intent to address the slowness issue. Using a listbox for user
> actions will process much faster, and without the added overhead of using
> a container plus multiple controls! Not to mention the entry point for all
> user actions is in one event, making code easier to manage/maintain
> IMO!<g>

I should have clarified last time this is not about creating "optional
menuitems", somewhat more than that!

Peter T

Tony Toews

unread,
May 2, 2013, 3:57:00 AM5/2/13
to
On Wed, 1 May 2013 19:51:21 +0100, "Peter T" <pet...@discussions.com>
wrote:

>> Create sufficient controls ahead of time but make them not visible.
>> Make them visible and position them as required.
>
>That wouldn't be viable, potentially a *lot* of controls might be needed.

So long as you are under the 255 or 755 or whatever the limit is
you'll be fine. A friend wrote the Frogger game in VB by creating
the necessary objects as controls and moving them around.

>But adding controls to a userform on a subform as required is working fine.

Glad you've got the problem solved.

Peter T

unread,
May 2, 2013, 11:21:50 AM5/2/13
to

"Tony Toews" <tto...@telusplanet.net> wrote in message
> On Wed, 1 May 2013 19:51:21 +0100, "Peter T" <pet...@discussions.com>
> wrote:
>
>>> Create sufficient controls ahead of time but make them not visible.
>>> Make them visible and position them as required.
>>
>>That wouldn't be viable, potentially a *lot* of controls might be needed.
>
> So long as you are under the 255 or 755 or whatever the limit is
> you'll be fine. A friend wrote the Frogger game in VB by creating
> the necessary objects as controls and moving them around.

Not sure there is any specific limit as there is with VB6 controls. 1000+ is
OK though 2000+ slows down exponentially.

Peter T

Peter T

unread,
May 2, 2013, 12:05:58 PM5/2/13
to
"Peter T" <pet...@discussions.com> wrote in message
>
> So how to place the Userform window on the Access form's window such that
> it behaves like an object that moves with the Access form's scrollbars?

Rather than start a new thread a related question. It's all working now
except for one small detail: when the captionless userform attached to the
subform/main-form gains focus, the main form's caption switches to inactive
highlighting, obviously I suppose.

Is there any way to reset the main form's caption as the active window,
whilst at the same time keeping focus in the userform, in particular to
receive key strokes?

Peter T

Tony Toews

unread,
May 13, 2013, 4:35:49 PM5/13/13
to
On Thu, 2 May 2013 16:21:50 +0100, "Peter T" <pet...@discussions.com>
wrote:

>>>> Create sufficient controls ahead of time but make them not visible.
>>>> Make them visible and position them as required.
>>>
>>>That wouldn't be viable, potentially a *lot* of controls might be needed.
>>
>> So long as you are under the 255 or 755 or whatever the limit is
>> you'll be fine.
>
>Not sure there is any specific limit as there is with VB6 controls. 1000+ is
>OK though 2000+ slows down exponentially.

My humble apologies. That should've been " A friend wrote the
Frogger game in *Access* by creating the necessary objects as controls
and moving them around."
0 new messages