473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform Control

Hello,

I have a main form. I want forms to open in a subform control box.
What is the code for the option group to open the subforms in the
control box.

I didn't create subforms, I created regular forms, but will create
subforms if that is needed for this to work.

My main goal is when a user clicks on a menu item and comes to a main
form, they can click on different buttons to open the needed form
without me having to create the same main form over and over again to
make it look good.

Below is what I was provided but I'm getting an error saying the
subform doesn't exist or is closed.

Create an option group with the number of options the same as the
number of
subforms. Here's the code for three subforms, you can expand it to
what ever
you need:
Me!MyTabCtl.Val ue = Me!MyOptionGrou p - 1
Select Case Me!MyOptionGrou p
Case 1
Me!Subform1MyFi eld.SetFocus
Case 2
Me!Subform2MyFi eld.SetFocus
Case 3
Me!Subform3MyFi eld.SetFocus
End Select

Put your menu on the left and add a subform control on the right. Use
the
menu to set the recordsource of the subform control
(Me!nameOfSubfo rmControl.Form. Recordsource = "SFrmMySubformN ame1").
You can
tinker with the properties of the subform control so that the subform
control is transparent and all you see is the current subform.


Put your menu on the left and add a subform control on the right. Use
the
menu to set the recordsource of the subform control
(Me!nameOfSubfo rmControl.Form. Recordsource = "SFrmMySubformN ame1").
You can
tinker with the properties of the subform control so that the subform
control is transparent and all you see is the current subform.
Let's say you need three different subforms. Create each subform and
name
them:
MySubform1
MySubform2
MySubform3
On the right side of your main form, add a subform control (from the
toolbox) and name it MySubformContro l. At this point, do not enter a
source
object for the subform control. For your menu you could use an option
group
with three options. Name the option group MyOptionGroup. Put the
following
code in the Afterupdate event of the option group:
Select Case Me!MyOptionGrou p
Case 1
Me!MySubformCon trol.Form.Sourc eObject = "MySubform1 "
Case 2
Me!MySubformCon trol.Form.Sourc eObject = "MySubform2 "
Case 3
Me!MySubformCon trol.Form.Sourc eObject = "MySubform3 "
End Select
Mar 27 '08 #1
1 3238
The main goal is to have a menu on the left and open different
subforms on the right. Doesn't have to be subforms, some are unbound
and some aren't.
Mar 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
24786
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit...
25
10183
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab...
12
18996
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course, frmBrowseNegsSubform. I would like to perform an ascending or descending sort on any of the 7 columns shown in datasheet view in the subform control. I've...
3
4137
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One of the tabs has a subform showing order data (in datasheet view). On the same tab there is an unbound textbox (next to the datasheet). I placed a
1
3033
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record in the second subform , the code generates the message: Can't find the field »POG-03 Work Subform« reffrred to in your expression.
6
2739
by: Mat | last post by:
Dear all, What I want to do is be able to use a string to refer to a control on a subform. IE: Forms!("Form1!form2!controlA").name or
6
5955
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few forms in the database that will use this function, so I need to be able to tell the code which form to unlock. What I have is as follows: Public...
4
8818
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I...
7
12291
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm thinking the Table will stay open otherwise ??? - Do I also need to use code to Assign the Child&Master Links, or can I just type the names into...
0
7922
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. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
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...
0
7964
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...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
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
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.