Combo box error - Help please...

swedish_mania

Registered User.
Local time
Today, 05:58
Joined
Feb 8, 2005
Messages
43
I have 5 table (See attachment).

I also have a booking form, which is a combination of the other four tables. The client table is linked to the driver table, as one client is tutored by one driver. So i have created a combo box for both the client and driver, so when you select the client, you can only select the driver who is assigned to that client.

To do this i had to change the row source of the client combo to:
SELECT Client.DriverID, Client.ClientID, Client.Forename, Client.Surname FROM Client;

And create an After Update, Event procedure:
Private Sub cboClient_AfterUpdate()
Me.cboDriver.Requery
End Sub

I changed the row source of the driver combo to:
SELECT Driver.DriverID, Driver.Forename, Driver.Surname FROM Driver WHERE [DriverID]=[cboClient];

This works fine. I can select the client and the driver combo produces the result i want.

The Problem: I get this error msg- You cannot add or change a record because a related record is required in table 'Client'.

The client table contains both the ClientID and the DriverID, so there is a related record. Since the drop down list for the client combo, is related to the client table, i cant see why there is a problem. I hope someone can help, thank you in advance...
 

Attachments

Did you verify that you do not have the two ID's inverted at some point in the Qry or the Code?
 
Not sure what you mean, please explain. Thank you
 

Users who are viewing this thread

Back
Top Bottom