Quando executo a função abaixo para atualizar a tabela do o seguinte erro : Erro em tempo de execução (3146) ODBC - falha na chamada
Option Compare Database
Public Sub ComparaTabelasEatualiza()
'By JPaulo ® Maximo Access
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Set db = CurrentDb()
Set rs1 = db.OpenRecordset("select * from issues_redmine ORDER BY ID ASC", dbReadOnly)
rs1.MoveFirst
Do Until rs1.EOF
Set rs2 = db.OpenRecordset("select * from issues where ID=" & rs1!id)
If rs2.EOF Then
rs2.AddNew
rs2![id] = rs1![id]
'rs2![OS] = rs1![OS]
rs2![tracker_id] = rs1![tracker_id]
rs2![project_id] = rs1![project_id]
'rs2![Id_Criticidade] = rs1![Id_Criticidade]
'rs2![Cod_Solicitante] = rs1![Cod_Solicitante]
rs2![subject] = rs1![subject]
rs2![description] = rs1![description]
rs2![due_date] = rs1![due_date]
rs2![category_id] = rs1![category_id]
rs2![status_id] = rs1![status_id]
rs2![assigned_to_id] = rs1![assigned_to_id]
rs2![priority_id] = rs1![priority_id]
rs2![fixed_version_id] = rs1![fixed_version_id]
rs2![author_id] = rs1![author_id]
rs2![lock_version] = rs1![lock_version]
rs2![created_on] = rs1![created_on]
rs2![updated_on] = rs1![updated_on]
rs2![start_date] = rs1![start_date]
rs2![done_ratio] = rs1![done_ratio]
rs2![estimated_hours] = rs1![estimated_hours]
rs2![rank] = rs1![rank]
'rs2![Dt_Fechamento] = rs1![Dt_Fechamento]
rs2.Update
Else
rs2.MoveFirst
Do Until rs2.EOF
rs2.Edit
rs2![id] = rs1![id]
'rs2![OS] = rs1![OS]
rs2![tracker_id] = rs1![tracker_id]
rs2![project_id] = rs1![project_id]
'rs2![Id_Criticidade] = rs1![Id_Criticidade]
'rs2![Cod_Solicitante] = rs1![Cod_Solicitante]
rs2![subject] = rs1![subject]
rs2![description] = rs1![description]
rs2![due_date] = rs1![due_date]
rs2![category_id] = rs1![category_id]
rs2![status_id] = rs1![status_id]
rs2![assigned_to_id] = rs1![assigned_to_id]
rs2![priority_id] = rs1![priority_id]
rs2![fixed_version_id] = rs1![fixed_version_id]
rs2![author_id] = rs1![author_id]
rs2![lock_version] = rs1![lock_version]
rs2![created_on] = rs1![created_on]
rs2![updated_on] = rs1![updated_on]
rs2![start_date] = rs1![start_date]
rs2![done_ratio] = rs1![done_ratio]
rs2![estimated_hours] = rs1![estimated_hours]
rs2![rank] = rs1![rank]
'rs2![Dt_Fechamento] = rs1![Dt_Fechamento]
rs2.Update
rs2.MoveNext
Loop
End If
rs1.MoveNext
Loop
rs1.Close
rs2.Close
MsgBox "Actualizado com Sucesso...", vbInformation
End Sub
Option Compare Database
Public Sub ComparaTabelasEatualiza()
'By JPaulo ® Maximo Access
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Set db = CurrentDb()
Set rs1 = db.OpenRecordset("select * from issues_redmine ORDER BY ID ASC", dbReadOnly)
rs1.MoveFirst
Do Until rs1.EOF
Set rs2 = db.OpenRecordset("select * from issues where ID=" & rs1!id)
If rs2.EOF Then
rs2.AddNew
rs2![id] = rs1![id]
'rs2![OS] = rs1![OS]
rs2![tracker_id] = rs1![tracker_id]
rs2![project_id] = rs1![project_id]
'rs2![Id_Criticidade] = rs1![Id_Criticidade]
'rs2![Cod_Solicitante] = rs1![Cod_Solicitante]
rs2![subject] = rs1![subject]
rs2![description] = rs1![description]
rs2![due_date] = rs1![due_date]
rs2![category_id] = rs1![category_id]
rs2![status_id] = rs1![status_id]
rs2![assigned_to_id] = rs1![assigned_to_id]
rs2![priority_id] = rs1![priority_id]
rs2![fixed_version_id] = rs1![fixed_version_id]
rs2![author_id] = rs1![author_id]
rs2![lock_version] = rs1![lock_version]
rs2![created_on] = rs1![created_on]
rs2![updated_on] = rs1![updated_on]
rs2![start_date] = rs1![start_date]
rs2![done_ratio] = rs1![done_ratio]
rs2![estimated_hours] = rs1![estimated_hours]
rs2![rank] = rs1![rank]
'rs2![Dt_Fechamento] = rs1![Dt_Fechamento]
rs2.Update
Else
rs2.MoveFirst
Do Until rs2.EOF
rs2.Edit
rs2![id] = rs1![id]
'rs2![OS] = rs1![OS]
rs2![tracker_id] = rs1![tracker_id]
rs2![project_id] = rs1![project_id]
'rs2![Id_Criticidade] = rs1![Id_Criticidade]
'rs2![Cod_Solicitante] = rs1![Cod_Solicitante]
rs2![subject] = rs1![subject]
rs2![description] = rs1![description]
rs2![due_date] = rs1![due_date]
rs2![category_id] = rs1![category_id]
rs2![status_id] = rs1![status_id]
rs2![assigned_to_id] = rs1![assigned_to_id]
rs2![priority_id] = rs1![priority_id]
rs2![fixed_version_id] = rs1![fixed_version_id]
rs2![author_id] = rs1![author_id]
rs2![lock_version] = rs1![lock_version]
rs2![created_on] = rs1![created_on]
rs2![updated_on] = rs1![updated_on]
rs2![start_date] = rs1![start_date]
rs2![done_ratio] = rs1![done_ratio]
rs2![estimated_hours] = rs1![estimated_hours]
rs2![rank] = rs1![rank]
'rs2![Dt_Fechamento] = rs1![Dt_Fechamento]
rs2.Update
rs2.MoveNext
Loop
End If
rs1.MoveNext
Loop
rs1.Close
rs2.Close
MsgBox "Actualizado com Sucesso...", vbInformation
End Sub