473,387 Members | 1,798 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,387 software developers and data experts.

Dynamic Subforms - synchronize with mainform

3
I am trying to use the information provided in Allen Brownes response see
Response.

I have a mainform, a tabctl with 5 pages , 5 subforms and 1 subfrom control. I placed the subformname in the page tag for each of the pages. (That should load the proper subform when the tabctl is clicked).

Now I'm trying to synchronize the subforms with the mainform and am having difficulty. The subform control is not bound.

The mainform contains company information. The link field is EstabNo.
Each subform also has an EstabNo. It is possible that no data will exist for some subforms. In those cases I'd like the tab for that page to be hidden.

Any info would be appreciated.

jedraw
Mar 7 '07 #1
5 3888
MSeda
159 Expert 100+
Have you been successful at altering the subform source object and they are displaying all records or do the subs not load?
Do you have both the Link master fields and Link Child fields for the sub control set to EstabNo?
Mar 9 '07 #2
jedraw
3
Thanks MSeda for replying.

I am getting all records.
I'm trying the approach Allen Browne suggested - 1 subform control and dynamically assigning the subform name to be opened.

I'm not sure where or how to link the child and master fields in code.
Is the link field associated with the subform form or the subform control?

I have 5 tabs, and depending on which tab is clicked, I want to link that subform's field with the Master. The subforms are loading - but I'm getting all records.

Also, some of the subforms for some records will have no data - In those cases I'd like to hide the Tab in the tab control.

The sources for my forms are queries.

jedraw
Mar 9 '07 #3
MSeda
159 Expert 100+
Since all of you forms contain the field “EstabNo” you should be able to set the links in the Design view properties window . Select the subform container and view its properties. On the data tab just below the source object (which is blank) you should see Link Master Fields and Link Child Fields just enter “EstabNo” into both of these.

In order to set the visible property of each page of the tab control you are going to have to test for the data when the record on the main form changes.
In the main forms oncurrent event do something like

Expand|Select|Wrap|Line Numbers
  1. If isnull(dlookup(“sub1DataPK”, “sub1DataQuery”, “EstabNo = “ & me.EstabNo”)) then
  2. me.page1.visible = false
  3. else
  4. me.page1.visible = true
  5. End if
  6.  
  7. …Repeat for the other subforms
  8.  
Mar 9 '07 #4
jedraw
3
Thanks again MSeda.

I now have it working. I just typed in the name for the Child fields / Master fieldsand it worked fine. Previously I clicked the ellipses and Access said I could not build a link between unbound forms.

Thanks for the advice.

Is there any way to improve the speed when reading Maiin form records. It works , but it is a little slow. I have tried the read when using the subform that has least amount of data -that's as fast as I can make it go.

jedraw
Mar 9 '07 #5
MSeda
159 Expert 100+
I'm glad you got the sub forms working. The wizard for linked forms is very deceiving about the capabilities of linking fields they are really much more flexible than the wizard indicates. Forms or controls do not neccessarily have to be bound to be used with a link field.

Regarding the speed of records being accessed by the main form , there are a variety of factors that can affect a forms performance.
The first thing I would examine is the forms underlying query. Is the query itself sluggish to open? Is the record based on an unusually large dataset? if so, are their ways you can decrease the number of records returned by filtering or using limiting criteria. The use of domain aggregates can also slow down a query.

Another consideration is how the user navigates the records. If the user has can choose a specific record from a combo box before the query is run that may help since then only one record will be returned.

If you like post the sql from the main form and any of the sub forms as well as any other relevent data and we'll have a look.
Mar 10 '07 #6

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

Similar topics

0
by: Arnold | last post by:
Hi there, I have a form to organize bottles in mind, but am unsure if it will work. Here's some background info: Mainform = frmProduct, which contains fields for pricing, status, etc. of...
0
by: Jenni | last post by:
I currently have a query that is joining two distinct pools of information and turning them into one records with a unique identifier This query is dependent on criteria passed from a form in a...
8
by: Zlatko Matić | last post by:
Hello. How can I synchronize subforms content with current record in master form, if both form and subform are based on DAO code ? I assigned DAO recordset to forms by using QueryDef, on Load...
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...
2
by: Robert Jacobs | last post by:
Please Help! I have read over and over again to go to Allen Browne's website to filter subforms, but I just don't understand it, and I can't get it to work in my situation. Any advice is very...
2
by: Ron | last post by:
Hi All, I've got a main form (frmMain) with 5 subforms on it. All subforms are linked to different hidden controls on frmMain. The purpose of this form is to record payments by 'source'...
3
by: 6afraidbecause789 | last post by:
Think school - students - discipline interventions - misbehaviors - staff for this one....On a mainform frmStudentInterventions, I have linked a subform (sfrmMisbehaviors) with another subform...
4
by: Rich P | last post by:
Maybe you could try using a query as the recordsource for your subforms and for the criteria field in the query you could use a Form parameter. This way - instead of using the form filter property...
64
by: lovelydan | last post by:
hi all i need someone to help me with a code that will enable me filter records in a subform form through a combo box attached to a mainform-that has a main menu that controls all the sub form...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.