Dear friends,
I have one table in a datbase which will be updated from the table of other database on satisfying some conditions as follows:
Private Sub Command1_Click()
Dim noflds As Variant
Dim fldx As Variant
Dim wrkDefault As Workspace
Set wrkDefault = DBEngine.Workspaces(0)
wrkDefault.BeginTrans
fldx = 0
noflds = Data1.Recordset.Fields.Count
With Data1.Recordset
.MoveFirst
If Not .BOF Then
Do Until .EOF
If ![TRANS_status] > 2 And Not ![REMOTE_POST] Then
.Edit
![REMOTE_POST] = 1
Data2.Recordset.AddNew
For take = 0 To noflds - 1
Data2.Recordset.Fields(take) = Data1.Recordset.Fields(take)
Next take
Data2.Recordset.Update
.Update
End If
.MoveNext
Loop
End If
End With
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans
Else
wrkDefault.Rollback
End If
when I am running this command I am getting Error message as data type conversion error 3421. Data type are same except differences in Indices. Please need help!
I have one table in a datbase which will be updated from the table of other database on satisfying some conditions as follows:
Private Sub Command1_Click()
Dim noflds As Variant
Dim fldx As Variant
Dim wrkDefault As Workspace
Set wrkDefault = DBEngine.Workspaces(0)
wrkDefault.BeginTrans
fldx = 0
noflds = Data1.Recordset.Fields.Count
With Data1.Recordset
.MoveFirst
If Not .BOF Then
Do Until .EOF
If ![TRANS_status] > 2 And Not ![REMOTE_POST] Then
.Edit
![REMOTE_POST] = 1
Data2.Recordset.AddNew
For take = 0 To noflds - 1
Data2.Recordset.Fields(take) = Data1.Recordset.Fields(take)
Next take
Data2.Recordset.Update
.Update
End If
.MoveNext
Loop
End If
End With
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans
Else
wrkDefault.Rollback
End If
when I am running this command I am getting Error message as data type conversion error 3421. Data type are same except differences in Indices. Please need help!