katie george
New member
- Local time
- Today, 08:48
- Joined
- Apr 13, 2004
- Messages
- 7
Hi - I am having troubles copying data from one form to another..
I have two tables customer and vehicle, the primary key in the customer table is CUSTOMER_ID (autonumber, long integer, indexed with no duplicates) this is the foreign key in the vehicle table CUSTOMER_ID (long integer, general number, indexed, duplicates ok).
When the user has entered the customer details in form CUSTOMER they click on a save button which gives them the option to add vehicle details. The VEHICLE form opens with a blank record.
I have been trying to get the CUSTOMER_ID in CUSTOMER to be copied into the CUSTOMER_ID field in VEHICLE when the form opens using the following code..
DoCmd.OpenForm "VEHICLE",OpenArgs:=CUSTOMER_ID
then in the Form_Open procedure of the form VEHICLE:
Private Sub Form_Open(Cancel as Integer)
CUSTOMER_ID = OpenArgs
End Sub
This works if the CUSTOMER_ID field in VEHICLE is unbound but not when its control property is CUSTOMER_ID, so therefore does not update the VEHICLE table with the value copied just leaves it blank. Having fiddled around for ages is there anyway of copying this value into the CUSTOMER_ID field and underlying table?
Any help is much appreciated
Thanx
I have two tables customer and vehicle, the primary key in the customer table is CUSTOMER_ID (autonumber, long integer, indexed with no duplicates) this is the foreign key in the vehicle table CUSTOMER_ID (long integer, general number, indexed, duplicates ok).
When the user has entered the customer details in form CUSTOMER they click on a save button which gives them the option to add vehicle details. The VEHICLE form opens with a blank record.
I have been trying to get the CUSTOMER_ID in CUSTOMER to be copied into the CUSTOMER_ID field in VEHICLE when the form opens using the following code..
DoCmd.OpenForm "VEHICLE",OpenArgs:=CUSTOMER_ID
then in the Form_Open procedure of the form VEHICLE:
Private Sub Form_Open(Cancel as Integer)
CUSTOMER_ID = OpenArgs
End Sub
This works if the CUSTOMER_ID field in VEHICLE is unbound but not when its control property is CUSTOMER_ID, so therefore does not update the VEHICLE table with the value copied just leaves it blank. Having fiddled around for ages is there anyway of copying this value into the CUSTOMER_ID field and underlying table?
Any help is much appreciated
Thanx