Solved

ListBox on top of Subform

Posted on 2000-04-17
18
290 Views
Last Modified: 2012-05-04
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.

 
0
Comment
Question by:GOLLEM
  • 9
  • 4
  • 2
  • +3
18 Comments
 
LVL 6

Expert Comment

by:simonbennett
ID: 2722076
Is you subform Modal? If so, turn it off.

HTH

Simon
0
 
LVL 10

Expert Comment

by:paasky
ID: 2722083
Hello GOLLEM,

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

Regards,
Paasky
0
 

Expert Comment

by:toesable
ID: 2722101
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
 

Author Comment

by:GOLLEM
ID: 2722136
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
 

Author Comment

by:GOLLEM
ID: 2722182
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
 

Expert Comment

by:toesable
ID: 2722198
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
 

Expert Comment

by:toesable
ID: 2722201
Oh, hey, are you on 97 or 2000?
0
 

Author Comment

by:GOLLEM
ID: 2722229
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
 

Author Comment

by:GOLLEM
ID: 2722235
tried locking the subform also, doesn't work either
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 54

Expert Comment

by:nico5038
ID: 2722253
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
 

Expert Comment

by:toesable
ID: 2722255
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
 

Author Comment

by:GOLLEM
ID: 2722291
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
 
LVL 6

Accepted Solution

by:
simonbennett earned 15 total points
ID: 2722508
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
 

Author Comment

by:GOLLEM
ID: 2722539
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
 
LVL 3

Expert Comment

by:jerelw
ID: 2729236
right click and select "top"
0
 

Author Comment

by:GOLLEM
ID: 2729808
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
 

Author Comment

by:GOLLEM
ID: 2746764
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
 

Author Comment

by:GOLLEM
ID: 2772674
I don't want to keep this thread open indefinitely, so I'm awarding the points to Simon.

regards,

         Michiel
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

708 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

18 Experts available now in Live!

Get 1:1 Help Now