Kamis, 22 Oktober 2015

Re: Re: [MS_AccessPros] Re: Sub continuous forms side by side

 

John-
It worked perfectly well. Thanks and Good night from China.
Kevin


Regards,
Kevin Zhao
 
Date: 2015-10-23 00:00
Subject: Re: [MS_AccessPros] Re: Sub continuous forms side by side
 

I'm going to attempt to paste the content of that second web page below…



John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



———————————
This is a common requirement in a database application.  Here are a few random examples:
  • You manage financial transactions in your database.  You have a form based on a Bank Deposit, where you use a continuous view or datasheet subform to list all payments received.  And then, for each payment, you need to split the amount in order to allocate to potentially more than one account code.
  • You are running a tournament for a team sport.  For each Grade/League/Division of the tournament, you want to see a list of the teams entered.  And then, within the same user interface, you want the ability to see information about the players registered for each team.
 
So, this requirement typically arises in databases where you are working with data in a one-to-many-to-many configuration.
 
This article is an introductory overview of the possibilities.  The example used is not intended to be a complete solution.  It has been simplified in order to illustrate the concepts.  Screen shots are in Access 2003, but the same approaches can be applied in other versions of Access, including Access 2007.
 
We will suppose that a service provider wishes to see listed all the services booked on a specific date, in this case the same date as the service being shown on the current record of the main form.  And then, they want to have access within this interface to some core information about the people registered on each of the services.
 
Here are three ways that this can be approached…
 
Subdatasheet
 
Access does not allow a continuous view form to have another continuous view form, or datasheet view form, embedded in its Detail section.
 
However, with a form in datasheet view, you can put a subform into the Detail section, with its Link Master Fields and Link Child Fields properties defined in the usual way, and the form will create it as a subdatasheet.
 
The form design can be done along these lines:
 
 
When opened, the form can look like this, if the sub-subform also has its Default View property set to Datasheet:
 
 
Here we see that Access automatically displays a column of [+]/[-] symbols, that can be used to expand or collapse the subform row, to show the related sub-subform data.  Each row can be expanded/collapsed independently, so you can see more than one at once.
 
If you set the sub-subform's Default View to Continuous Forms, you can then have access to some of the additional functionality supported by continuous forms that is not available in datasheets.  For example, as illustrated below, formatting of Labels in the Header, Command Buttons, or Option Groups.
 
 
 
Form Footer Section
 
By making a fairly simple design change to the above, we create a different paradigm.  Move the sub-subform from the Detail section into the Footer section of the subform, like this:
 
 
The first level subform no longer needs to be datasheet view, so it can be changed to a continuous form.  With the sub-subform as a datasheet, we see something like this:
 
 
So the sub-subform in the footer automatically refreshes to show the related data to whatever is the current subform record.  Unlike the subdatasheet concept, in this case you can only see related data for one record at a time.  But this provides a nice intuitive interface for this type of functionality.
 
Once again, the sub-subform can also be continuous view, allowing the richer interface options:
 
 
 
Side By Side
 
Another approach is to display both subforms on the main form, alongside each other.  This approach has an advantage if the nature of the data means that there can be a large number of related records for each "one" side record.
 
This is designed so that the "many" side subform shows the related data to the current record on the "one" side subform.  To achieve this, a hidden control is placed on the main form, referencing the key field on the "one" side subform.  And then this control is used as the Link Master Fields property of the "many" side subform.  In the illustration below, this linking control is shown in green.
 
 
So in Form view we get something like this…
 
 
The right-hand subform automatically refreshes to show the data related to whatever is the current record in the left-hand subform.
 
Another good example of this concept can be seen by scrolling to the bottom of this page:
 

On Oct 22, 2015, at 5:49 PM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Celal-
Thanks a lot. But I couldn't open the second link with examples from China. Is it possible to upload that example to group folder? Thanks again.
Best Regards,
Kevin


 
Date: 2015-10-22 23:06
Subject: [MS_AccessPros] Re: Sub continuous forms side by side
 


Hi Kevin,
 
I needed to do this sometime ago, guess I understand what you mean. Here are two examples that may help:
 
 
The second one gives examples of 3 possibilities: Subdatasheet, Form Footer Section and Side By Side
 
Hope it helps
 
Celal


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Kevin-

It's possible to do the subforms "side by side" or on tabs, but you have to do a little work to keep the second subform synchronized.  Put an unbound hidden text box on the outer form and use it to set the Link Master property of the second subform.  In the Current event of the first subform, copy the link field value to that text box on the outer form.  You might also have to do a Requery of the second subform to get it to automatically sync to the current row on the first subform.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Oct 22, 2015, at 2:23 PM, zhaoliqingoffice zhaoliqingoffice@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John-
Actually I want to put two subforms side by side, not in the footer.
Kevin



在 "zhaoliqingoffice zhaoliqingoffice@... [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015年10月22日 下午7:19写道:

 

John-
The main form is the GroupBooking,one of the subform is subBookingPart, by which I can divided the whole itinerary into different parts. Then the other subform is linked to subBookingPart, Called subServiceBooking. In this case, The main form contains a subform, and the subform contains another subform, and this may go on...
I hope I explain it clearly. Please help, John. Thanks in advance.
Best Regards,
Kevin



在 "John Viescas JohnV@... [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>,2015年10月22日 下午5:52写道:

 

Kevin-


Why do you think you need to put one of the subforms in the footer?  What is the relationship between the Record Source for the outer form and the Record Source in the two subforms?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Oct 22, 2015, at 12:13 AM, zhaoliqingoffice zhaoliqingoffice@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


Dear All,
Is that possible to attach two sub continuous froms to the main form side by side, instead of putting one in the footer? Is there any example? Thanks in advance.
Best Regards,
Kevin






 


__._,_.___

Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (13)

.

__,_._,___

Tidak ada komentar:

Posting Komentar