I am trying to add a new Expense to my Expense table using an unbound form:
INSERT INTO Expenses ( ProjectID, Employee, [Expense Type], [Total Expense], [Date Purchased], [Date Submitted], [Payment Method], [Purpose of Expense] )
SELECT Projects.ProjectID, Forms![New Expense]!Combo2 AS Employee, Forms![New Expense]!Combo4 AS [Expense Type], Forms![New Expense]!Text6 AS [Total Expense], Forms![New Expense]!Text10 AS [Date Purchased], Forms![New Expense]!Text8 AS [Date Submitted], Forms![New Expense]!Combo12 AS [Payment Method], Forms![New Expense]!Text14 AS [Purpose of Expense]
FROM Projects INNER JOIN Expenses ON Projects.ProjectID = Expenses.ProjectID
WHERE (((Projects.ProjectID)=[Forms]![New Expense]![List20]));
The problem that I am running into is that instead of adding just one new record, I end up adding duplicate records that increase exponentially based on the number of times a ProjectID is in the Expense table.
I think that the problem is the relationships between my Project Table and my Expense Table, but I do not know how to fix it.
Any help would be GREATLY appreciated.
Thanks!
INSERT INTO Expenses ( ProjectID, Employee, [Expense Type], [Total Expense], [Date Purchased], [Date Submitted], [Payment Method], [Purpose of Expense] )
SELECT Projects.ProjectID, Forms![New Expense]!Combo2 AS Employee, Forms![New Expense]!Combo4 AS [Expense Type], Forms![New Expense]!Text6 AS [Total Expense], Forms![New Expense]!Text10 AS [Date Purchased], Forms![New Expense]!Text8 AS [Date Submitted], Forms![New Expense]!Combo12 AS [Payment Method], Forms![New Expense]!Text14 AS [Purpose of Expense]
FROM Projects INNER JOIN Expenses ON Projects.ProjectID = Expenses.ProjectID
WHERE (((Projects.ProjectID)=[Forms]![New Expense]![List20]));
The problem that I am running into is that instead of adding just one new record, I end up adding duplicate records that increase exponentially based on the number of times a ProjectID is in the Expense table.
I think that the problem is the relationships between my Project Table and my Expense Table, but I do not know how to fix it.
Any help would be GREATLY appreciated.
Thanks!