sarthur
10-11-2001, 09:33 PM
I have three tables used in a form:
tblCompany : CompanyID (PK), CompanyName, etc
tblProject : ProjectID (PK), ProjectName, CompanyID (FK), etc
tblQuote : QuoteNumber (PK), ProjectID (FK), etc
NOTE: PK = Primary Key; FK = Foreign Key
What I'm trying to achieve is a form for entering new Quotes. This form requires the user to select the CompanyName in one list box and the ProjectName in another, from which a QuoteNumber is generated. What I'd like to happen is that when the CompanyName is changed in one list box, then the list box for the ProjectName will only allow a selection of projects from the Project Table with the same CompanyID. I have somewhat achieved this using DLookup(), however the problem is that I've linked the data in the list boxes to the tables, so that if I change the CompanyName, then the CompanyID is changed in the Project Table. This means the Project is associated with the wrong Company!
What is the best way to achieve this?
tblCompany : CompanyID (PK), CompanyName, etc
tblProject : ProjectID (PK), ProjectName, CompanyID (FK), etc
tblQuote : QuoteNumber (PK), ProjectID (FK), etc
NOTE: PK = Primary Key; FK = Foreign Key
What I'm trying to achieve is a form for entering new Quotes. This form requires the user to select the CompanyName in one list box and the ProjectName in another, from which a QuoteNumber is generated. What I'd like to happen is that when the CompanyName is changed in one list box, then the list box for the ProjectName will only allow a selection of projects from the Project Table with the same CompanyID. I have somewhat achieved this using DLookup(), however the problem is that I've linked the data in the list boxes to the tables, so that if I change the CompanyName, then the CompanyID is changed in the Project Table. This means the Project is associated with the wrong Company!
What is the best way to achieve this?