472,353 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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.Value = Me!MyOptionGroup - 1
Select Case Me!MyOptionGroup
Case 1
Me!Subform1MyField.SetFocus
Case 2
Me!Subform2MyField.SetFocus
Case 3
Me!Subform3MyField.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!nameOfSubformControl.Form.Recordsource = "SFrmMySubformName1").
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!nameOfSubformControl.Form.Recordsource = "SFrmMySubformName1").
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 MySubformControl. 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!MyOptionGroup
Case 1
Me!MySubformControl.Form.SourceObject = "MySubform1"
Case 2
Me!MySubformControl.Form.SourceObject = "MySubform2"
Case 3
Me!MySubformControl.Form.SourceObject = "MySubform3"
End Select
Mar 27 '08 #1
1 3157
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
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...
25
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...
12
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...
3
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...
1
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...
6
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
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)...
4
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...
7
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.