Hello All
I'm having a hard time trying to get pass this annoying error... the cool thing about this is that the user gets to see the error, and when i go to my dev environment everything works just fine.. Here is my code:
If ColaI.Recordset.RecordCount > 0 Then
Dim Resp, Monto, Act, Var1, Var2, Var3, Var4, Var5, Var6, Var7, Var8, Var9, Var10
Resp = MsgBox("Esta Seguro de Querer Actualizar Cola de Impresión ?", vbOKCancel, "Actualización de Cola")
If Resp = vbCancel Then
SSCommand2.SetFocus
Exit Sub
End If
Sql2 = "Select Tci_Statu, Tci_Serie, Tci_Nbcia, Cc_Descr, tci_destn, Cad_Descr, tci_Tgast, Ctg_Descr, Tci_Valor, Tci_Ndsap, tci_supli, tci_ccost, tci_npsap, Tci_Fecha From T_Cola_Impresion left outer join C_Tipos_Gastos on T_Cola_Impresion.Tci_Tgast = C_Tipos_Gastos.Ctg_Codig left outer join C_Companias on T_Cola_Impresion.Tci_Nbcia = C_Companias.Cc_Codig left outer join C_Agentes_Aduanas on T_Cola_Impresion.Tci_Destn = C_Agentes_Aduanas.Cad_Codig where Tci_Statu <> 0"
ColaI.RecordSource = Sql2
ColaI.Refresh
'
Sql3 = "Select sum(Tci_Valor) as Monto From T_Cola_Impresion left outer join C_Tipos_Gastos on T_Cola_Impresion.Tci_Tgast = C_Tipos_Gastos.Ctg_Codig left outer join C_Companias on T_Cola_Impresion.Tci_Nbcia = C_Companias.Cc_Codig left outer join C_Agentes_Aduanas on T_Cola_Impresion.Tci_Destn = C_Agentes_Aduanas.Cad_Codig where Tci_Statu <> 0"
Suma.RecordSource = Sql3
Suma.Refresh
If ColaI.Recordset.RecordCount > 0 Then
'Set dbs = OpenDatabase("t:\aduana\aduana.mdb")
'Set rst = dbs.OpenRecordset("select sum(tci_valor) as [Monto] from T_Cola_Impresion where Tci_Statu")
'' Actualizando Tabla de Secuencias de Solicitudes a Contabilidad
Cover.Recordset.AddNew
Cia = ColaI.Recordset!tci_Nbcia
Cover.Recordset!Tss_Nbcia = Cia
Cover.Recordset!Tss_Monto = Suma.Recordset!Monto
Cover.Recordset!Tss_Fecha = Date
Cover.Recordset.Update
Cover.Recordset.MoveLast
Serie = Cover.Recordset!Tss_Serie
Report.ReportFileName = "v:\aduansql\srepslcaj.rpt"
Report.SelectionFormula = "({T_Sec_Solicitudes.Tss_Serie} = " & Serie & ")"
Report.Action = 1
'
'dbs.Close
ColaI.Recordset.MoveFirst
Act = "N"
While Act = "N"
Hcola.Recordset.AddNew
Var1 = ColaI.Recordset!Tci_Serie
Var2 = ColaI.Recordset!tci_Nbcia
Var3 = ColaI.Recordset!tci_destn
Var4 = ColaI.Recordset!tci_valor
Var5 = ColaI.Recordset!tci_Tgast
Var6 = ColaI.Recordset!tci_Fecha
Var7 = ColaI.Recordset!tci_npsap
Var8 = ColaI.Recordset!tci_ndsap
Var9 = ColaI.Recordset!tci_supli
Var10 = ColaI.Recordset!tci_ccost
'
Sql3 = "SELECT * FROM T_Asig_Gastos where Ag_Ncia = '" & Var2 & "' and Ag_Serie = " & Var1 & ""
Asig_Gastos.RecordSource = Sql3
Asig_Gastos.Refresh
If Asig_Gastos.Recordset.RecordCount > 0 Then
'Asig_Gastos.Recordset.Edit
Asig_Gastos.Recordset!Ag_Pgsol = True
Asig_Gastos.Recordset.Update
End If
Hcola.Recordset!Hci_serie = Var1
Hcola.Recordset!Hci_nbcia = Var2
Hcola.Recordset!Hci_destn = Var3
Hcola.Recordset!Hci_valor = Var4
Hcola.Recordset!Hci_tgast = Var5
Hcola.Recordset!Hci_fecha = Var6
Hcola.Recordset!Hci_npsap = Var7
Hcola.Recordset!Hci_ndsap = Var8
Hcola.Recordset!Hci_supli = Var9
Hcola.Recordset!Hci_ccost = Var10
Hcola.Recordset!Hci_Fchsl = Date
Hcola.Recordset.Update
On Error GoTo Mensaje
'
Sql4 = "SELECT * FROM T_Cola_Impresion where Tci_Nbcia = '" & Var2 & "' and Tci_Serie = " & Var1 & ""
Tcola.RecordSource = Sql4
Tcola.Refresh
If Tcola.Recordset.RecordCount > 0 Then
Tcola.Recordset.Delete
Tcola.Recordset.Update
End If
'
ColaI.Recordset.MoveNext
If ColaI.Recordset.EOF Then
Act = "Y"
End If
Wend
'MsgBox "Proceso Exitosamente Concluído", vbExclamation, "Good For You !"
End If
Sql2 = "Select Tci_Statu, Tci_Serie, Cc_Descr, Cad_Descr, Ctg_Descr, Tci_Valor, Tci_Ndsap From T_Cola_Impresion left outer join C_Tipos_Gastos on T_Cola_Impresion.Tci_Tgast = C_Tipos_Gastos.Ctg_Codig left outer join C_Companias on T_Cola_Impresion.Tci_Nbcia = C_Companias.Cc_Codig left outer join C_Agentes_Aduanas on T_Cola_Impresion.Tci_Destn = C_Agentes_Aduanas.Cad_Codig order by Cc_Descr, Tci_Serie"
ColaI.RecordSource = Sql2
ColaI.Refresh
Exit Sub
Mensaje:
MsgBox "Duplicación de Registro no se Puede Actualizar el Histórico, Favor de Corregir", vbCritical, "Mensaje de Error !"
SSCommand2.SetFocus
Exit Sub
End If