G
Guest
Hi
I am trying to aadd records to a many to many relationship.
I have these tables:
Vehicles (Primary Key VRM)
Drivers (Primary Key DriverID
VehiclesDrivers (Primary keys VRM and DriverID)
I know how to add an entry in the driver table using a form, and how to add
a vehicle to the vehicles table using a form. I have a main form, Vehicles,
with Drivers as a subform. I have set up the subform to show only drivers
who are already related to the vehicle. The problem is how to enter a new
vehicle on the main form then add new drivers associated with it in the
drivers subform.
When I just add a new driver on the subform, access says, "Field Cannot Be
Updated." However, the drivers table does get updated with this new driver,
although the VehiclesDrivers table doesn't.. The query on the subform is
SELECT Drivers.Surname, Drivers.[First Names], Drivers.DOB, Drivers.Sex,
Drivers.Address, VehiclesDrivers.VRM FROM Drivers INNER JOIN VehiclesDrivers
ON Drivers.DriverID=VehiclesDrivers.DriverID;
How do I add new records to the drivers table which are also related to the
vehicle displayed in the main form (ie write an entry into both the drivers
table and the VehiclesDrivers table ?)
I am trying to aadd records to a many to many relationship.
I have these tables:
Vehicles (Primary Key VRM)
Drivers (Primary Key DriverID
VehiclesDrivers (Primary keys VRM and DriverID)
I know how to add an entry in the driver table using a form, and how to add
a vehicle to the vehicles table using a form. I have a main form, Vehicles,
with Drivers as a subform. I have set up the subform to show only drivers
who are already related to the vehicle. The problem is how to enter a new
vehicle on the main form then add new drivers associated with it in the
drivers subform.
When I just add a new driver on the subform, access says, "Field Cannot Be
Updated." However, the drivers table does get updated with this new driver,
although the VehiclesDrivers table doesn't.. The query on the subform is
SELECT Drivers.Surname, Drivers.[First Names], Drivers.DOB, Drivers.Sex,
Drivers.Address, VehiclesDrivers.VRM FROM Drivers INNER JOIN VehiclesDrivers
ON Drivers.DriverID=VehiclesDrivers.DriverID;
How do I add new records to the drivers table which are also related to the
vehicle displayed in the main form (ie write an entry into both the drivers
table and the VehiclesDrivers table ?)