Quarfelburg
asked on
Error Message - You cannot add or change a record because a related record is required in table tblProducts.
I have created a database that is quite similar to the Northwind sample. When I try to add an item on my sales form I get the following error message:
"You cannot add or change a record because a related record is required in table tblProducts."
Any ideas?
"You cannot add or change a record because a related record is required in table tblProducts."
Any ideas?
ASKER
When I select a product from my dropdown (calls on tblProducts) I can view all my records but when I actually select the record I get that message.
Since I am selecting from Inventory, I would think my record has already been created. However the control source for this dropdown is ProductID in tblSalesDetails, and not ProductID in tblProducts, is this my problem?
Could you perhaps provide an example as to what you mean by "you must design a form so that it first creates a record in tblProducts before populating the secondary table."?
I am new to Access so please try to bear with me =)
Thanks a lot,
Hayden
Since I am selecting from Inventory, I would think my record has already been created. However the control source for this dropdown is ProductID in tblSalesDetails, and not ProductID in tblProducts, is this my problem?
Could you perhaps provide an example as to what you mean by "you must design a form so that it first creates a record in tblProducts before populating the secondary table."?
I am new to Access so please try to bear with me =)
Thanks a lot,
Hayden
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is what I am currently using as my row source:
SELECT [tblProducts].[Category], [tblProducts].[Description ], [tblProducts].[SupplierID] , [tblProducts].[Style], [tblProducts].[Wood], [tblProducts].[Stain], [tblProducts].[Hardware], [tblProducts].[Rivets], [tblProducts].[InvS] FROM tblProducts ORDER BY [Category], [Description];
Are you saying that if ProductID is also listed it should work?
SELECT [tblProducts].[Category], [tblProducts].[Description
Are you saying that if ProductID is also listed it should work?
ASKER
Nerocula, I put in ProductID as the first column and it worked! Thanks a lot! I am still kind of confused as to how this all worked, so if you have the time could you explain where I went wrong?
Thanks.
Thanks.
Hayden,
When you use dropdowns Access uses the value from the first column. What probably happened is that since Category was in the first column, it used that value - since values in category doesn't match any productID in tblProducts it gave you that error.
I hope this clears things up a bit for you.
When you use dropdowns Access uses the value from the first column. What probably happened is that since Category was in the first column, it used that value - since values in category doesn't match any productID in tblProducts it gave you that error.
I hope this clears things up a bit for you.
ASKER
It does, thanks.
For example, you tried to insert a product ID in your tlbSales that doesn't exists as a product yet in tblProducts.
Hope this helps.