splats
Technical User
- Jan 2, 2003
- 131
Hello
I have a command button on a form that runs an append query and then an update query in Access 2007. The update query works no problem. However, the Append Query does not work. Here is the code that I am using. Anyone have any ideas to make it work?
Append Query (this one results in a key violation error)
INSERT INTO tblPersonnel ( EmployeeID, FirstName, MiddleName, LastName, Gender, SpouseName, StreetAddress, City, Province, PostalCode, Country, HomePhone, CellPhone, Department, Occupation, Site, BirthDate, StartDate, RetirementDate )
SELECT ImportData.EmployeeID, ImportData.FirstName, ImportData.MiddleName, ImportData.LastName, ImportData.Gender, ImportData.SpouseName, ImportData.StreetAddress, ImportData.City, ImportData.Province, ImportData.PostalCode, ImportData.Country, ImportData.HomePhone, ImportData.CellPhone, ImportData.Department, ImportData.Occupation, ImportData.Site, ImportData.BirthDate, ImportData.StartDate, ImportData.RetirementDate
FROM [qu-PersonnelImport] INNER JOIN ImportData ON [qu-PersonnelImport].EmployeeID = ImportData.EmployeeID;
Update Query (this one works fine!)
UPDATE ImportData INNER JOIN [qu-PersonnelImport] ON ImportData.EmployeeID = [qu-PersonnelImport].EmployeeID SET ImportData.EmployeeID = [ImportData].[EmployeeID], [qu-PersonnelImport].FirstName = [ImportData].[FirstName], [qu-PersonnelImport].MiddleName = [ImportData].[MiddleName], [qu-PersonnelImport].LastName = [ImportData].[LastName], [qu-PersonnelImport].Gender = [ImportData].[Gender], [qu-PersonnelImport].SpouseName = [ImportData].[SpouseName], [qu-PersonnelImport].StreetAddress = [ImportData].[StreetAddress], [qu-PersonnelImport].City = [ImportData].[City], [qu-PersonnelImport].Province = [ImportData].[Province], [qu-PersonnelImport].PostalCode = [ImportData].[PostalCode], [qu-PersonnelImport].Country = [ImportData].[Country], [qu-PersonnelImport].HomePhone = [ImportData].[HomePhone], [qu-PersonnelImport].CellPhone = [ImportData].[CellPhone], [qu-PersonnelImport].Department = [ImportData].[Department], [qu-PersonnelImport].Occupation = [ImportData].[Occupation], [qu-PersonnelImport].Site = [ImportData].[Site], [qu-PersonnelImport].BirthDate = [ImportData].[BirthDate], [qu-PersonnelImport].StartDate = [ImportData].[StartDate], [qu-PersonnelImport].RetirementDate = [ImportData].[RetirementDate];
TYVM
Tina
I have a command button on a form that runs an append query and then an update query in Access 2007. The update query works no problem. However, the Append Query does not work. Here is the code that I am using. Anyone have any ideas to make it work?
Append Query (this one results in a key violation error)
INSERT INTO tblPersonnel ( EmployeeID, FirstName, MiddleName, LastName, Gender, SpouseName, StreetAddress, City, Province, PostalCode, Country, HomePhone, CellPhone, Department, Occupation, Site, BirthDate, StartDate, RetirementDate )
SELECT ImportData.EmployeeID, ImportData.FirstName, ImportData.MiddleName, ImportData.LastName, ImportData.Gender, ImportData.SpouseName, ImportData.StreetAddress, ImportData.City, ImportData.Province, ImportData.PostalCode, ImportData.Country, ImportData.HomePhone, ImportData.CellPhone, ImportData.Department, ImportData.Occupation, ImportData.Site, ImportData.BirthDate, ImportData.StartDate, ImportData.RetirementDate
FROM [qu-PersonnelImport] INNER JOIN ImportData ON [qu-PersonnelImport].EmployeeID = ImportData.EmployeeID;
Update Query (this one works fine!)
UPDATE ImportData INNER JOIN [qu-PersonnelImport] ON ImportData.EmployeeID = [qu-PersonnelImport].EmployeeID SET ImportData.EmployeeID = [ImportData].[EmployeeID], [qu-PersonnelImport].FirstName = [ImportData].[FirstName], [qu-PersonnelImport].MiddleName = [ImportData].[MiddleName], [qu-PersonnelImport].LastName = [ImportData].[LastName], [qu-PersonnelImport].Gender = [ImportData].[Gender], [qu-PersonnelImport].SpouseName = [ImportData].[SpouseName], [qu-PersonnelImport].StreetAddress = [ImportData].[StreetAddress], [qu-PersonnelImport].City = [ImportData].[City], [qu-PersonnelImport].Province = [ImportData].[Province], [qu-PersonnelImport].PostalCode = [ImportData].[PostalCode], [qu-PersonnelImport].Country = [ImportData].[Country], [qu-PersonnelImport].HomePhone = [ImportData].[HomePhone], [qu-PersonnelImport].CellPhone = [ImportData].[CellPhone], [qu-PersonnelImport].Department = [ImportData].[Department], [qu-PersonnelImport].Occupation = [ImportData].[Occupation], [qu-PersonnelImport].Site = [ImportData].[Site], [qu-PersonnelImport].BirthDate = [ImportData].[BirthDate], [qu-PersonnelImport].StartDate = [ImportData].[StartDate], [qu-PersonnelImport].RetirementDate = [ImportData].[RetirementDate];
TYVM
Tina