ListBox on top of Subform

I have a temporary listbox which is displayed over a subform. However because the subform is "always on top" I can't click to make a selection.
In the help-file I read that both subforms and listboxes are "always on top".

Is there any way to get the listbox tohave a higher priority??? I could also use a pop-up for my listbox, but this is not an elegant solution in my opinion.

 
GOLLEMAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
simonbennettConnect With a Mentor Commented:
GOLLEM

Not sure but can you set the zorder in access like VB? If not try this API

in general declarations

Public Const HWND_TOPMOST = -1Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2Public Const SWP_NOSIZE = &H1
Public Const SWP_NOACTIVATE = &H10Public Const SWP_SHOWWINDOW = &H40
Public Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _
    (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
     ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

.... and then this function....

Dim r As Longr = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS)

HTH

Simon


0
 
simonbennettCommented:
Is you subform Modal? If so, turn it off.

HTH

Simon
0
 
paaskyCommented:
Hello GOLLEM,

You could hide (Me.Subform1.Visible = False) the subform when you want user to see listbox...

Regards,
Paasky
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
toesableCommented:
One way is to create the list box after you have created the subform.  i.e. place the subform then place the listbox when designing it.  The list box when not visible doesn't seem to mess with the use of the subform but you can still use the list box when it is visible.  Or, anyway, that's what happened in my test.  It seems that Access is getting it's priority from creation of the component.

Good Luck  
0
 
GOLLEMAuthor Commented:
simon->

Subform is not modal...

paasky->

I'd rather use the pop-up solution then, the subform is almost as big as the screen.
Looks a bit messy if your users see most of their screen disappear, along with everything they just filled in..
Next thing you know they're in panic *LOL*

toesable->

I created my listbox after my subform.
I'll try to achieve the same thing on another form, maybe I'll get lucky....

Another thought.....

Maybe it has to do with what control gets painted first (access paints a screen top-down) I'll check on that.

Regards,

        Michiel
0
 
GOLLEMAuthor Commented:
toesable->

tried it 20 times already and your solution doesn't work here....

Is there something I'm not seeing here??? Maybe you have one of MS-Acesses global variables set differently?? Or is there a patch I missed??

0
 
toesableCommented:
Weird. My test works perfectly.  Must have something set differently.  Just a shot in the dark here, have you tried setting the enabled property of the subform to false while working on the listbox or do you need them simultaneously active?
0
 
toesableCommented:
Oh, hey, are you on 97 or 2000?
0
 
GOLLEMAuthor Commented:
toesable->

enabled doesn't work...

I'm on '97. If you're on 2000, then this could be the first thing I've seen that's actually better in 2000.... :)

0
 
GOLLEMAuthor Commented:
tried locking the subform also, doesn't work either
0
 
nico5038Commented:
In 97 got a listbox partially "on top" of the subform, however.....

When clicking on the part that's over the subform, this is getting the focus !

Think you will have to use a different solution anyway !
(No space left on the mainform for a combo ?)

Nico
0
 
toesableCommented:
I agree with that.  2000 took two steps backwards, but that's what I'm on.  I'll let someone who's on 97 give it a try for you.  Take care  toe
0
 
GOLLEMAuthor Commented:
nico->

I'm using a listbox, because it looks better :)

I have about 1.25 cm left for the listbox, so that's about three entries. I want to display quite a long list in there, so I need more room.

O.k. since this doesn't seem to be possible in Access '97, I'm going to change the question:

I want to use a pop-up form for the listbox. How do I specify where to put the pop-up form relative to the main form??

(maybe through API, but how do I get the correct values and which API-calls do I have to use??)

 
0
 
GOLLEMAuthor Commented:
O.k. I found a different solution. I now use a second subform for my listbox. This does work and best of all you can't tell the difference... :)

0
 
jerelwCommented:
right click and select "top"
0
 
GOLLEMAuthor Commented:
Suppose you're talking about MS Access 2000 again???

I tried right clicking both in design view and in form view, both didn't produce the menuchoice you described....


I would prefer (as do most experts here) that you not answer a question but leave a comment so I can decide for myself who gets points...

Regards,

        Michiel
0
 
GOLLEMAuthor Commented:
Simon->

I was looking at your comment and got interrested...

I'm quite new at API, so could you please explain what the function does exactly?

My guess is that it sets the window that currently has the focus to the values specified.
The part 'ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long' would be left, top, width and height of the window in twips right???


What does the long that it returns stand for???

Is there also a function that returns the left, top width and height of the current window? (this woukd help if I ever would want to set the values for a window based upon another window.

Think I'll buy a book on API in the near future, can you recommend one?

Regards,

         Michiel


P.S. answer these questions and the points are yours of course :)
0
 
GOLLEMAuthor Commented:
I don't want to keep this thread open indefinitely, so I'm awarding the points to Simon.

regards,

         Michiel
0
All Courses

From novice to tech pro — start learning today.