Sabtu, 18 Oktober 2014

Re: [MS_AccessPros] Subform

 

I looked up a few of your fieldnames with a translator ... you should show information calculated from the main table ON the main form and position your subform such that you can see it.  A lot of good implementation is patterning your form designs after your table structures.  

In my opinion, each form/subform should be based on just one table*. If you wish to manipulate information in more than one table, it is best to use a main form to for the "parent" table and subforms to display and edit information in each of the related tables.

*Note: This is a general guideline that helps when you are beginning to use Access. As you get better and realize that certain records must be created before related records, you can bend this rule.

Create the main form and the form(s) that will be used as subform(s) -- make sure to put the linking key fields on them (usually ID fields).

to put a subform on a main form:

Create a subform control on your main form using the subform/subreport tool in the toolbox (Cancel the wizard if it pops up and fill properties manually)

Then, from the design view of the main form:

1. turn on the properties window – Right-Click anywhere and choose Properties from the shortcut menu

2. Click ONE time on the subform control if it is not already selected

3. Click on the DATA tab of the Properties window

SourceObject --> drop list and choose the name of the form you will use as a subform (You can also Drag a form object from the database window and drop it on the main form. This automatically sets the SourceObject property.)

LinkMasterFields --> MainID
LinkChildFields --> MainID

If you have multiple fields, delimit the list with semi-colon

LinkMasterFields --> MainID;Fieldname_main
LinkChildFields --> MainID;Fieldname_child

WHERE:
-- MainID is replaced with your field name holding an AutoNumber field (usually) in the parent table and a Long Integer field in the child table. Fieldname_main is the fieldname in the main RecordSet – and it is best to actually put the field on the main form. Fieldname_child is the name of a field in the child RecordSet – and, once again, it is best that this field actually be ON the related subform.

Even though the Help for Access says that the linking fields do not have to be ON the forms, I find this not be to be the case. It is best that you reference fields that are ON each of the respective forms. If a control is bound, I usually make the Name of the control the same as the ControlSource (what is in it). This does not follow standards but I find that it eases confusion. There are those who disagree and insist that controls should be named according to their favorite naming convention such as Leszynski/Reddick

It is common to set the Visible property to No for the control(s) containing the field(s) used in LinkChildFields

4. while still on the subform control, Click the ALL tab in the Properties window -- change the Name property to match the SourceObject property (minus Form. in the beginning if Access puts it there).

Difference between Subform Control and Subform

The first Click on a subform control puts handles* around the subform control.
*black squares in the corners and the middle of each side -- resizing handles

The subform control has properties such as
Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

The subform control is the container for the subform or subreport used as the SourceObject.

The second Click on a subform control gets you INTO the subform that is contained by the subform control …then when you first Click on the contained form, you will see a black square where the rulers intersect in the upper left of the "form" you are "in"

me.subform_controlname --> the subform control
me.subform_controlname.form --> the form inside the subform control
me.subform_controlname.form.controlname --> a control on the form contained by the subform control

The form that is contained by the subform control is an independent form -- you can open it directly from the database window, just as you can with any other form. It is often referred to as a "subform" because of the way it is being used.

It is advisable to edit forms used as subforms directly, instead of within the main form.

Be sure to disable Name AutoCorrect

Failures caused by Name AutoCorrect
http://allenbrowne.com/bug-03.html

Warm Regards,
Crystal

video Tip: Enforce Referential Integrity on Access Relationships (cc) closed-caption
http://www.youtube.com/watch?v=_zxxc9jzWEg

 *
   (: have an awesome day :)
 *


On Saturday, October 18, 2014 1:42 PM, Crystal <strive4peace2008@yahoo.com> wrote:


thanks, John ~

Dennis, since the message is already on my clipboard, here it is:

~~~~~~~~~~~~~~~~
Dennis,

as Duane is driving to, I believe ... there is an issue creating a record because neither the Produkter table or the Prisdata table should be in the recordset.  What you want to fill is records in Orderspecifikationer.  They will be linked to your main form via LinkMasterFields and LinkChildFields which will both be set to Produktnr

If you want to echo fields from another table, create a combobox on the subform and use the RowSource to get the other values you want to display.  Then you can make textboxes on your form with ControlSource:
=combo_controlname.column(1)

where
1 is the column number -1 ... so column index 1 is actual column number 2


Warm Regards,
Crystal

video -- Access Contact Template, Contact Management System (CMS) Music by Ken Gaines (cc)
~~~~~~~~~~~~~~~

Warm Regards,
Crystal

 *
   (: have an awesome day :)
 *




On Saturday, October 18, 2014 1:14 PM, "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:




Dennis-

You can always find older messages at:



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 18, 2014, at 8:14 PM, Dennis Davidsson dennisdavidsson@ymail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Hi Crystal.

you sent me a very detailed suggestion on my problem with my subform the other day, but I had no opportunity to try it out then, 
and when I was to look at it today, I found that I accidentally had deleted it from my mailbox.
So my hope now, is that you still may have your answer to me still available to resend it to me.
If this is possible, it would be a great help for me.

Kindly regards
Dennis








__._,_.___

Posted by: Crystal <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (32)

.

__,_._,___

Tidak ada komentar:

Posting Komentar