I am trying to move entire columns between two tables.
The first attempt:
gives me a run-time error 3073
'Operation must use an updatable query'
Second attempt:
The 'if Not Isnull' because the update query gives me a syntax error if the SET value is NULL.
The UPDATE stops with run-tim error 3061:
'Too few parameters. Expected 1.'
Where am I wrong?
Thanks for your replies.
The first attempt:
Code:
dbsInWater.Execute _
"UPDATE StreamerTable SET StreamerTable.Weights = (SELECT Weights FROM StreamerVars)"
'Operation must use an updatable query'
Second attempt:
Code:
Dim ASet As Recordset
' get the primary key of the 1st record in destination table
Set ASet = dbsInWater.OpenRecordset("SELECT ID FROM StreamerTable")
With ASet
.MoveFirst
j = !ID
.Close
End With
Set ASet = dbsInWater.OpenRecordset("SELECT Weights FROM StreamerVars") ''' Source table
With ASet
.MoveLast
n = .RecordCount
.MoveFirst
For i = 1 To n
If Not IsNull(!Weights) Then
dbsInWater.Execute _
"UPDATE StreamerTable SET [Weights] =" & ![Weights] & "" & _ "WHERE StreamerTable.[ID] = j"
End If
j = j + 1
.MoveNext
Next
.Close
End With
The 'if Not Isnull' because the update query gives me a syntax error if the SET value is NULL.
The UPDATE stops with run-tim error 3061:
'Too few parameters. Expected 1.'
Where am I wrong?
Thanks for your replies.