Hey all!
I got this code from a video, trying to take data from one table, merge it with data on another without any duplicates.
But it gives me the attached error (3141).
Thoughts?
I got this code from a video, trying to take data from one table, merge it with data on another without any duplicates.
But it gives me the attached error (3141).
Code:
Private Sub cmdCreateTable_Click()
Dim sql As String, sTable As String, oTD As TableDef
sql = "SELECT * FROM [T-SupplierPartNums] UNION SELECT * FROM [PartNumTemp]"
If MsgBox("Would you like to rename the table?", vbYesNo) = vbYes Then
sTable = InputBox("Enter Table Name: ", , "[SupplierPartNum]")
End If
For Each oTD In CurrentDb.TableDefs
If oTD.Name = sTable Then sTable = sTable & "1"
Next oTD
sql = "SELECT * INTO " & sTable & " FROM (" & sql & ")"
DoCmd.RunSQL sql
End Sub
Thoughts?