Having problems retrieving an array to a table!
Have array1 and have array2 printed on the immediate window.Array1 comes from tb1 and array2 comes from array1 and fieldE which is not
on tb1.Tb1 and tb2 have no fields in common to make a one-to-many relationship.I am having problems to insert array2 in tb2.Here comes the code:
Sub InsertARecord1(str0 As Variant, str1 As Variant, _
str2 As Variant, str3 As Variant, str4 As Variant)
Dim cmd1 As ADODB.Command
Set cmd1 = New Command
With cmd1
.ActiveConnection = CurrentProject.Connection
'.CommandText = "INSERT INTO Tb2(ID, " & _
" Nome, Código, Evento, Dia1,Dia2,Dia3) VALUES (" & str0 & "," & str1 & "," & _
str2 & "," & str3 & "," & str4 & ")"
.CommandText = "INSERT INTO Tb2 " & _
"VALUES (" & str0 & "," & str1 & "," & _
str2 & "," & str3 & "," & str4 & ")"
.CommandType = adCmdText
.Execute
End With
End Sub
I have filled strn with array2 and have tried naming the fields and
not naming the fields on the INSERT INTO command.Have not managed to fill Tb2 with strn VALUES.
Have error messages "missing parameters on query Tb2".
Any idea of what i am doing wrong or if this task is not possible are welcome.
Regards P.
|