From: Avid Fan on
A big thank you again for the help I have been given so far.

I want to create a child record linking to the original customer.

I thought this would be simple

[call]![customer_ID].value = [customer]![ID].value

[customer]![ID].value gives me the ID of the first record in the table,
not the currently selected record.

What is the easy way of doing this?
From: John W. Vinson on
On Fri, 26 Mar 2010 04:40:56 +1100, Avid Fan <me(a)privacy.net> wrote:

>A big thank you again for the help I have been given so far.
>
>I want to create a child record linking to the original customer.
>
>I thought this would be simple
>
>[call]![customer_ID].value = [customer]![ID].value
>
>[customer]![ID].value gives me the ID of the first record in the table,
>not the currently selected record.
>
>What is the easy way of doing this?

What's the context? If you have a Form based on the customer table, and a
Subform based on the calls table, and use the ID as the master/child link
field, Access takes care of all of it for you: synchronizes the calls with the
customer, inserts the ID in new records, etc. with no code at all.
--

John W. Vinson [MVP]
From: KARL DEWEY on
If you set one-to-many relationship between tblCustomer and tblCallInfo,
using Referential Integerity & Cascade Update, and then form/subform for
customer/call info with Master/Child link set on the related fields it will
automatically add the Customer_ID when you add a new call record.

--
Build a little, test a little.


"Avid Fan" wrote:

> A big thank you again for the help I have been given so far.
>
> I want to create a child record linking to the original customer.
>
> I thought this would be simple
>
> [call]![customer_ID].value = [customer]![ID].value
>
> [customer]![ID].value gives me the ID of the first record in the table,
> not the currently selected record.
>
> What is the easy way of doing this?
> .
>
From: Avid Fan on
On 26/03/2010 7:10 AM, John W. Vinson wrote:
> On Fri, 26 Mar 2010 04:40:56 +1100, Avid Fan<me(a)privacy.net> wrote:
>
>> A big thank you again for the help I have been given so far.
>>
>> I want to create a child record linking to the original customer.
>>
>> I thought this would be simple
>>
>> [call]![customer_ID].value = [customer]![ID].value
>>
>> [customer]![ID].value gives me the ID of the first record in the table,
>> not the currently selected record.
>>
>> What is the easy way of doing this?
>
> What's the context? If you have a Form based on the customer table, and a
> Subform based on the calls table, and use the ID as the master/child link
> field, Access takes care of all of it for you: synchronizes the calls with the
> customer, inserts the ID in new records, etc. with no code at all.in

Access2007 Win 7 creating an Access 2003 compatible database

Well I must be doing something wrong. I have set a relation between
customer.id and call.Customer_id

Customer.id is primary autonumber
call.customer_id is a number

Thanks for your help.

From: Avid Fan on
On 26/03/2010 7:48 AM, KARL DEWEY wrote:
> If you set one-to-many relationship between tblCustomer and tblCallInfo,
> using Referential Integerity& Cascade Update, and then form/subform for
> customer/call info with Master/Child link set on the related fields it will
> automatically add the Customer_ID when you add a new call record.
>

Does not work

Error

The Microsoft database engine cannot find a record in the table
'customer' with key matching 'customer_ID'

It is as if it searching the wrong way round.


I have checked my relationships it is 1 to many as expected


customer.id = call.customer_ID do the field names have to be the same?