473,789 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overlapping subforms - bringing any one to "top of the stack"

Walt in Decatur
20 New Member
I have set up a bunch of subforms to appear in the same spot on the screen relative to the main form. I have set up command buttons with open and close each subform. However, if I have several open at the same time, only the one that is "later" in the order of controls shows, the others sit underneath and one can't set focus on them.

First question. Design-wise, I like the way I've set this up, as one can expect a subform to always pop up in the same spot. But is this a good idea?
Second question. What would be the code for a command button to bring any particular subform to the top, in front of others? Can this be done easily regardless of how many subforms are open at any given time?

Thanks, oh wise Access gurus!
Jun 15 '07 #1
3 5973
ADezii
8,834 Recognized Expert Expert
I have set up a bunch of subforms to appear in the same spot on the screen relative to the main form. I have set up command buttons with open and close each subform. However, if I have several open at the same time, only the one that is "later" in the order of controls shows, the others sit underneath and one can't set focus on them.

First question. Design-wise, I like the way I've set this up, as one can expect a subform to always pop up in the same spot. But is this a good idea?
Second question. What would be the code for a command button to bring any particular subform to the top, in front of others? Can this be done easily regardless of how many subforms are open at any given time?

Thanks, oh wise Access gurus!
Let's assume you have 6 stacked Sub-Forms, and you wish to view SubFormTwo. Just set its Visible Property to True and the rest to False, something similar to the code below:

Expand|Select|Wrap|Line Numbers
  1. 'Want to view SubFormTwo
  2. Me!SubFormOne.Visible = False
  3. Me!SubFormTwo.Visible = True
  4. Me!SubFormThree.Visible = False
  5. Me!SubFormFour.Visible = False
  6. Me!SubFormFive.Visible = False
  7. Me!SubFormSix.Visible = False
Jun 15 '07 #2
JKing
1,206 Recognized Expert Top Contributor
If you don't need more than one of the subform open at any one time you could just as easily flip the sourceobject each time you want a different form to appear. This means only having one subform pane on your main form instead of stacking 6 subforms on the same form. All you would have to do is put the correct subform name in for each button click event.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubForm1_Click()
  2. Me.sfrm.SourceObject = "sfrm1"
  3. End Sub
  4.  
Jun 18 '07 #3
Walt in Decatur
20 New Member
Bingo! Thanks!

This is the way I chose to implement it (now that I got back to working on my form). I think it's the simplest way, indeed. I probably should have thought of this in the first place, but I'm still learning how to exploit properties of various controls to my advantage. Not having any formal training makes for interesting adventures in coding. :-)

If you don't need more than one of the subform open at any one time you could just as easily flip the sourceobject each time you want a different form to appear. This means only having one subform pane on your main form instead of stacking 6 subforms on the same form. All you would have to do is put the correct subform name in for each button click event.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubForm1_Click()
  2. Me.sfrm.SourceObject = "sfrm1"
  3. End Sub
  4.  
Jul 10 '07 #4

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

Similar topics

87
5262
by: ziliath | last post by:
I recently tried out the Google "top coder" contest, as a C++ coder. I noticed immediately that they expected me to know STL. To which I say, what the fuck?! I may be missing something, but at what point when learning C++ was I supposed to have picked up STL? I ask because at every job I've had, and every job interview for that matter, whenever STL comes up it's not I, but a manager who says effectively yuck, we don't use that crap.
19
3301
by: Mason A. Clark | last post by:
How was I to know that "top" means "top" in MSIE6 ?? I was testing <a name="top"></a> at the top of the page with <a href="#top>go to top</a> at the bottom of the page. It always worked in IE so I drew conclusions only to discover that it worked even with <a name="xtop"></a> but not in Opera. IE6 understands "top" to mean *the top* !
6
7067
by: Mason A. Clark | last post by:
LAST WORD(s): 1. MSIE6 and Firefox will go to the top of the page on command <a href="#top">go upsy</a> even if there is NO name="top" or id="top" They know what a "top" is :-) Opera does not.
16
4455
by: Gufus | last post by:
Hi Group... <a name="#top"></a> ----del---- ----del---- <img SRC="images/top.gif" USEMAP="#top" BORDER=0> <map NAME="top">
6
2432
by: Generic Usenet Account | last post by:
Is it okay to return a local datastructure (something of type struct) from a function, as long as it does not have any pointer fields? I think it is a bad idea, but one of my colleagues does not seem to think so. According to my colleague, if the data structure does not "deep copy" issues, it is perfectly okay to return a local variable. This is because at the point of invocation, a copy of the data structure is made. In all fairness...
15
6735
by: Joe Van Dyk | last post by:
Can someone explain what a heap and what a stack is? And why I should care? I used to know, but then I forgot. And I can't seem to find it in the C++ FAQ. I keep reading how allocating from the heap is slow or something, and I have no idea why that would be. Joe
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.