473,382 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Replace Subform

Hi Guru's,
What I am trying to achieve is a main form with buttons down the left
side and the rest of the form filled with a sub form. When one of the
buttons is clicked, the sub form with be populated with a corresponding
form. What I think is needed is to update the source object of the subform
but I have no clue on how to do this! Any offers?

TIA,

Mark
Nov 13 '05 #1
3 2983
Rog
One way of doing this is putting all your subforms on top of each
other, make them hidden (set the visible property to no), then make one
of them visible, and the others hidden, when one of the buttons is
clicked. In the OnClick event of the button you would have
Me!Subform1.Visible = True
Me!Subform2.Visible = False
Me!Subform3.Visible = False, etc.

Nov 13 '05 #2
If your relationships are clearly defined then you can simply change
the subform in code and you dont even have to worry about Master /
child link fields. This code works fine for me:

me.myChildControlName.ObjectSource = "myNewFormName"
me.myChildControlName.Requery

If you dont have defined relationships between the underlying tables /
queries in the forms, then you may have to set the Master and Child
Link fields...

me.myChildControlName.LinkMasterFields = "Ref Key"
me.myChildControlName.LinkChildFields = "Foreign Key"

Another approach might be to use tabs instead of buttons with a subform
in each tab Or as Rog suggested, hiding and making visible various
subforms - but remember: the more subforms you have open at once, the
slower your form will be.

Nov 13 '05 #3
Thanx for your suggestions. I managed to achieve what I wanted with
Me.SubFormName.SourceObject = "Form_Name"

Thanks again,

Mark

"BillCo" <co**********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
If your relationships are clearly defined then you can simply change
the subform in code and you dont even have to worry about Master /
child link fields. This code works fine for me:

me.myChildControlName.ObjectSource = "myNewFormName"
me.myChildControlName.Requery

If you dont have defined relationships between the underlying tables /
queries in the forms, then you may have to set the Master and Child
Link fields...

me.myChildControlName.LinkMasterFields = "Ref Key"
me.myChildControlName.LinkChildFields = "Foreign Key"

Another approach might be to use tabs instead of buttons with a subform
in each tab Or as Rog suggested, hiding and making visible various
subforms - but remember: the more subforms you have open at once, the
slower your form will be.
Nov 13 '05 #4

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 or been changed, i.e. dirty. The form that...
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 ID. The parent form (frmMainForm) displays the...
1
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
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 the button »AddNewSubSubRecord« (add a new record...
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) to unlock text boxes on a subform. I have a few...
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 control button on the main form opens a pop-up form...
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 DeAssign the SourceObject when leaving the Tab, I'm...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.