I have set a relationship between the master and child tables.
Customer.ID -> callnotes.Customer_ID
Enforce referential integrity.
Cascade updates.
I am told Access is supposed to put the customer.ID value in the
callnotes.Customer_ID it is not working
How do I do it manually in VBA code?
|
|
0
|
|
|
|
Reply
|
Avid
|
3/26/2010 6:44:44 PM |
|
"Avid Fan" <me@privacy.net> wrote in message
news:%236Q8lRRzKHA.3884@TK2MSFTNGP06.phx.gbl...
>I have set a relationship between the master and child tables.
>
> Customer.ID -> callnotes.Customer_ID
>
> Enforce referential integrity.
> Cascade updates.
>
>
> I am told Access is supposed to put the customer.ID value in the
> callnotes.Customer_ID it is not working
>
>
> How do I do it manually in VBA code?
You don't. This is controlled by the Link Master Fields and Link Child
Fields properties of the subform control. If you created that relationship
after you added the subform to the main form, Access would not have been
able to guess that those were the linking fields, so you have to go to the
properties of the subform control -- the control on the main form that
displays the subform -- and enter "ID" in the Link Master Fields property
and "Customer_ID" in the Link Child Fields property (without quotes around
the field names).
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
|
|
0
|
|
|
|
Reply
|
Dirk
|
3/26/2010 7:12:46 PM
|
|
On Sat, 27 Mar 2010 05:44:44 +1100, Avid Fan <me@privacy.net> wrote:
>I have set a relationship between the master and child tables.
>
>Customer.ID -> callnotes.Customer_ID
>
>Enforce referential integrity.
>Cascade updates.
>
>
>I am told Access is supposed to put the customer.ID value in the
>callnotes.Customer_ID it is not working
WHat happens when you enter data into the note field?
I have NEVER ONCE seen a master/child link field fail. I think your
expectation is what is faulty: just having the relationship or having the
master/child links will NOT automagically create a new empty record in the
callnotes table. It will only be created when you *actually enter data onto
the subform* - are you?
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
3/26/2010 7:18:44 PM
|
|
On 27/03/2010 6:18 AM, John W. Vinson wrote:
> On Sat, 27 Mar 2010 05:44:44 +1100, Avid Fan<me@privacy.net> wrote:
>
>> I have set a relationship between the master and child tables.
>>
>> Customer.ID -> callnotes.Customer_ID
>>
>> Enforce referential integrity.
>> Cascade updates.
>>
>>
>> I am told Access is supposed to put the customer.ID value in the
>> callnotes.Customer_ID it is not working
>
> WHat happens when you enter data into the note field?
>
> I have NEVER ONCE seen a master/child link field fail. I think your
> expectation is what is faulty: just having the relationship or having the
> master/child links will NOT automagically create a new empty record in the
> callnotes table. It will only be created when you *actually enter data onto
> the subform* - are you?
I fill data into the memo text box. I change the one other control left
combobox
I even have a save record and move to next record buttons on the forms
I have placed a text box control linked to customer_id the only way I
can get the record to save is by placing a valid ID number in the field.
|
|
0
|
|
|
|
Reply
|
Avid
|
3/27/2010 12:48:32 AM
|
|
On Sat, 27 Mar 2010 11:48:32 +1100, Avid Fan <me@privacy.net> wrote:
>I fill data into the memo text box. I change the one other control left
> combobox
>
>I even have a save record and move to next record buttons on the forms
>
>I have placed a text box control linked to customer_id the only way I
>can get the record to save is by placing a valid ID number in the field.
And this is in fact a Subform in a subform control (not a popup form launched
from code)?
Please post the SQL view of the mainform and the subform's Recorsource
properties and (again) the Master Link Field and Child Link Field properties
of the Subform. Something is very very odd here.
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
3/27/2010 1:31:39 AM
|
|
On 27/03/2010 6:12 AM, Dirk Goldgar wrote:
> "Avid Fan" <me@privacy.net> wrote in message
> news:%236Q8lRRzKHA.3884@TK2MSFTNGP06.phx.gbl...
>> I have set a relationship between the master and child tables.
>>
>> Customer.ID -> callnotes.Customer_ID
>>
>> Enforce referential integrity.
>> Cascade updates.
>>
>>
>> I am told Access is supposed to put the customer.ID value in the
>> callnotes.Customer_ID it is not working
>>
>>
>> How do I do it manually in VBA code?
>
>
> You don't. This is controlled by the Link Master Fields and Link Child
> Fields properties of the subform control. If you created that
> relationship after you added the subform to the main form, Access would
> not have been able to guess that those were the linking fields, so you
> have to go to the properties of the subform control -- the control on
> the main form that displays the subform -- and enter "ID" in the Link
> Master Fields property and "Customer_ID" in the Link Child Fields
> property (without quotes around the field names).
>
That was it!!!!!!!!!
For some reason the customer.id was linked to callnotes.id not
callnotes.customer_id.
BIG THANK YOU!!!!!!
|
|
0
|
|
|
|
Reply
|
Avid
|
3/27/2010 1:50:33 AM
|
|
On 27/03/2010 12:31 PM, John W. Vinson wrote:
> On Sat, 27 Mar 2010 11:48:32 +1100, Avid Fan<me@privacy.net> wrote:
>
>> I fill data into the memo text box. I change the one other control left
>> combobox
>>
>> I even have a save record and move to next record buttons on the forms
>>
>> I have placed a text box control linked to customer_id the only way I
>> can get the record to save is by placing a valid ID number in the field.
>
> And this is in fact a Subform in a subform control (not a popup form launched
> from code)?
>
> Please post the SQL view of the mainform and the subform's Recorsource
> properties and (again) the Master Link Field and Child Link Field properties
> of the Subform. Something is very very odd here.
The error was in the Master Link Child link property of the subform.
for some reason they were linked to customer.Id callnotes.ID instead
of callnotes.customer_ID
It was an "ID ten IT " error (ID10T)
|
|
0
|
|
|
|
Reply
|
Avid
|
3/27/2010 2:06:42 AM
|
|
On Sat, 27 Mar 2010 13:06:42 +1100, Avid Fan <me@privacy.net> wrote:
>The error was in the Master Link Child link property of the subform.
>for some reason they were linked to customer.Id callnotes.ID instead
>of callnotes.customer_ID
>
>It was an "ID ten IT " error (ID10T)
I *won't* post how many times I've been burned by the same kind of error...
<g>
Glad you figured it out!
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
3/27/2010 2:43:13 AM
|
|
Dirk, I hope you can help me with a similar problem.
I have a form and subform with the master/child links as such:
Link Master Field=Name
Link Child Field=EmpName
My issue is that when I enter through the EmpName field instead of the field
being populated with the employee's name the name of the form, ContractsIn,
is entered into this field.
Any idea why?
Thank you in advance for any help.
Lori
"Dirk Goldgar" wrote:
> "Avid Fan" <me@privacy.net> wrote in message
> news:%236Q8lRRzKHA.3884@TK2MSFTNGP06.phx.gbl...
> >I have set a relationship between the master and child tables.
> >
> > Customer.ID -> callnotes.Customer_ID
> >
> > Enforce referential integrity.
> > Cascade updates.
> >
> >
> > I am told Access is supposed to put the customer.ID value in the
> > callnotes.Customer_ID it is not working
> >
> >
> > How do I do it manually in VBA code?
>
>
> You don't. This is controlled by the Link Master Fields and Link Child
> Fields properties of the subform control. If you created that relationship
> after you added the subform to the main form, Access would not have been
> able to guess that those were the linking fields, so you have to go to the
> properties of the subform control -- the control on the main form that
> displays the subform -- and enter "ID" in the Link Master Fields property
> and "Customer_ID" in the Link Child Fields property (without quotes around
> the field names).
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
5/17/2010 8:43:01 PM
|
|
"SSi308" <SSi308@discussions.microsoft.com> wrote in message
news:EF4E4E98-1938-411B-83E9-67EB369647AF@microsoft.com...
> Dirk, I hope you can help me with a similar problem.
> I have a form and subform with the master/child links as such:
> Link Master Field=Name
> Link Child Field=EmpName
> My issue is that when I enter through the EmpName field instead of the
> field
> being populated with the employee's name the name of the form,
> ContractsIn,
> is entered into this field.
> Any idea why?
>
> Thank you in advance for any help.
I suspect it's because "Name" is a very bad choice for the name of a field,
since most objects -- including your form! -- have a Name property. If it's
not too big a chore, I recommend you change the name of the field "Name" to
something more specific (such as "EmpName" or "ContactName") in the table
that holds it and in every query, form, and report that refers to it.
If you don't feel you can do that, then change the name of the *control* on
the main form that is bound to the Name field. Change it to something like
"txtName". Then put the control name in the Link Master Field property.
That should work.
Although the above quick fix ought to work, you really ought to do the more
involved job of changing the name of the field, because using this reserved
word for a field name will probably cause you a lot more trouble down the
road.
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
|
|
0
|
|
|
|
Reply
|
Dirk
|
5/17/2010 8:58:05 PM
|
|
On Mon, 17 May 2010 13:43:01 -0700, SSi308 <SSi308@discussions.microsoft.com>
wrote:
>Dirk, I hope you can help me with a similar problem.
>I have a form and subform with the master/child links as such:
>Link Master Field=Name
>Link Child Field=EmpName
>My issue is that when I enter through the EmpName field instead of the field
>being populated with the employee's name the name of the form, ContractsIn,
>is entered into this field.
>Any idea why?
Because Name is a reserved word. When you refer to Name in a form property,
Access quite reasonably thinks you mean the *name of the form*.
You really should change the <ahem> Name of the Name field to EmpName, or
PersonName, or some other non-reserved word. If you're unable to do so, set
the Link Master Field property to [Name], with the brackets, so Access will
have a better chance of guessing correctly.
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
5/17/2010 9:05:37 PM
|
|
"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news:jpb3v5pj21gl8k4cdokc6a7nnbhvj5pabo@4ax.com...
> You really should change the <ahem> Name of the Name field to EmpName, or
> PersonName, or some other non-reserved word. If you're unable to do so,
> set
> the Link Master Field property to [Name], with the brackets, so Access
> will
> have a better chance of guessing correctly.
As a test, John, I tried that and it didn't work. Using Access 2003, I
created a table containing a field named "Name", and created a form based on
that table with a subform linked by the Link Master Field [Name]. It didn't
seem to matter whether I set the property to "Name" or "[Name]" -- the same
phenomenon was manifested. Changing the control name to something else
fixed the problem.
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
|
|
0
|
|
|
|
Reply
|
Dirk
|
5/17/2010 9:19:56 PM
|
|
On Mon, 17 May 2010 17:19:56 -0400, "Dirk Goldgar"
<dg@NOdataSPAMgnostics.com.invalid> wrote:
>"John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
>news:jpb3v5pj21gl8k4cdokc6a7nnbhvj5pabo@4ax.com...
>
>> You really should change the <ahem> Name of the Name field to EmpName, or
>> PersonName, or some other non-reserved word. If you're unable to do so,
>> set
>> the Link Master Field property to [Name], with the brackets, so Access
>> will
>> have a better chance of guessing correctly.
>
>
>As a test, John, I tried that and it didn't work. Using Access 2003, I
>created a table containing a field named "Name", and created a form based on
>that table with a subform linked by the Link Master Field [Name]. It didn't
>seem to matter whether I set the property to "Name" or "[Name]" -- the same
>phenomenon was manifested. Changing the control name to something else
>fixed the problem.
Thanks Dirk! I didn't test it (obviously)... another REALLY good reason not to
use reserved words. I'm wondering if this is perhaps something we should
report as a bug; if you in fact cannot use Name, it should let you try in the
first place!
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
5/17/2010 10:31:35 PM
|
|
|
12 Replies
443 Views
(page loaded in 0.336 seconds)
Similiar Articles: OK my subform is not entering saving the key from the master ...OK my subform is not entering saving the key from the master datasource. Follow Subform master child link - microsoft.public.accessOK my subform is not entering saving the key from the master ... > I have a form and subform with the master/child links as such: > Link Master Field=Name > Link Child ... Popup Form Launched from SubForm Button and New Record Sync ...OK my subform is not entering saving the key from the master ..... in a subform control (not a popup form launched from ... create new record (Access 2007): Microsoft ... Save button in Customer Maintenance - microsoft.public.greatplains ...OK my subform is not entering saving the key from the master ... Customer.ID -> callnotes.Customer_ID Enforce referential integrity. Cascade ... Next, click the Save ... Creating a customer record in a child table - microsoft.public ...... call.customer_id is a number Ok, but ... to be the source of the problem, not your master/child link field or the subform itself. ... auto populate related (foreign) key fields ... how to handle meter readings - microsoft.public.access ...OK my subform is not entering saving the key from the master ... how to handle meter readings - microsoft.public.access ... ok - this isnt working i ... Auto populate a form from an open form - microsoft.public.access ...... are linked on the form via Master ... If not set that way, you won't be able to enter 2 calls with the same ... SUBFORM - AUTO POPULATE PRIMARY KEY - microsoft.public.access ... How do I scan in a form for entries and changes? - microsoft ...How can I can in a blank form into my documents > so > that I can enter ... NOT to save changes ... allows data entry into ... Master and Sub documents - microsoft.public ... Linking Parent Form to a Child Form - microsoft.public.access ...Also, when in Parent Information, when I enter a new ... You may need to save the parent record before clicking ... Figure: Adding the Foreign Key and Primary Key Field ... How to pull data from one table and save it to another - microsoft ...ok - what I'm trying to create is a ... then have a form that allows me to enter in my ... How to pull data from one table and save it to another - microsoft ... how to key ... OK my subform is not entering saving the key from the master ...OK my subform is not entering saving the key from the master datasource. Follow Access Flickering Subform by Corinna6 Jan 2010 Frequently, but not always, most of the form will flicker during t. OK my subform is not entering saving the key from the master Access 2010 parent/child subform issue when using sharepoint ...... on a datasource-free form. The top subform ... save the ... looks ok but the child subform no longer updates based on the master selection. The textbox referencing the key ... About subforms - Access - Office.com - Microsoft Corporation ...... often referred to as a hierarchical form, a master ... between two tables in which the primary key ... the current record in the main form when you enter data in the subform. Create a form that contains a subform (a one-to-many form ...... Form view, so that you can view or enter ... and the Link Child Fields and Link Master Fields properties of the subform ... the forms with, and then click OK. If you are not sure ... Visual Basic :: Master-detail Form-subform... section (master), I want to save not ... return/enter key ... through my master records the container field is shown in Text box1 and shows the field name ok. - Text2.Datasource ... Subform master child link - microsoft.public.access | Microsoft ...OK my subform is not entering saving the key from the master ... > I have a form and subform with the master/child links as such: > Link Master Field=Name > Link Child ... Creating Multitable Forms in MS Access - Microsoft Corporation ...Once you master this simple technique ... Form dialog box, and then click OK. Next, click the Save button (), enter ... generally, you link a primary key field in the subform ... Microsoft Access: Lesson 27 - Subforms - Tutorials From FunctionXPrimary Key Save the table as WorkOrders: InvoiceNumber ... Accept the suggested name of the subform and press Enter ... combo box, select OrderAndParts and click OK; To save ... MS Access: Refresh the contents of a subform whenever the record ...Click on the OK button. Now when you return to the subform properties window, you should see the "Link Child Fields" and "Link Master Fields" properties filled in. 7/24/2012 6:37:22 PM
|