I have a piece of code to import a record into a Database, part of it is to update an existing table that populates a combobox. The problem I am having is that I get a message "Duplicate output destination 'txt_FullName'. If the item wasn't in the list I could understand it happening, but its not! I have posted my code below along with the query. Many thanks.
And the query:
Code:
Private Sub btn_SaveImport_Click()
On Error GoTo btn_SaveImport_Click_Err
If IsNull(Me.DogID) Then
MsgBox ("You must load the record and then press the the Import Button")
Me.cbo_Import.SetFocus
Me.cbo_Import.Dropdown
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_AppendToDetectionTraining", acViewNormal, acEdit
DoCmd.OpenQuery "qry_AppendToTypeOfHideFromDetection", acViewNormal, acEdit
DoCmd.OpenQuery "qry_AppendToVenueFromDetection", acViewNormal, acEdit
DoCmd.OpenQuery "qry_AppendToWeatherFromDetection", acViewNormal, acEdit
DoCmd.OpenQuery "qry_AppendToSpecialistEquipmentFromDetection", acViewNormal, acEdit
DoCmd.OpenQuery "qry_AppendToOdourFromDetection", acViewNormal, acEdit
DoCmd.OpenQuery "qry_DeleteDectionTrainingImports"
'DoCmd.OpenQuery "Query1", acViewNormal, acEdit
DoCmd.SetWarnings True
MsgBox "Record has been imported"
Me.Requery
End If
btn_SaveImport_Click_Exit:
Exit Sub
btn_SaveImport_Click_Err:
MsgBox Error$
Resume btn_SaveImport_Click_Exit
End Sub
And the query:
Code:
INSERT INTO tbl_Odours ( txt_FullName )
SELECT tbl_Odours.*, tbl_Odours.txt_FullName
FROM tbl_DetectionImports LEFT JOIN tbl_Odours ON tbl_DetectionImports.Odour = tbl_Odours.[txt_Odour]
WHERE (((tbl_Odours.txt_FullName) Is Null));