Visual Basic - Error 13

Life is soft - evento anual de software empresarial
 
Vista:

Error 13

Publicado por Diana (1 intervención) el 17/02/2009 21:49:19
Estoy chekando un programa que jala unos archivos de base de datos, tengo varias carpetas con distintos archivos para hacer pruebas pero lo raro es que solo funciona con algunos y con otros sale el error 13 en tiempo de ejecucion, se supone que los archivos son del mismo tipo y estructura solo cambian los datos, alguien podria ayudarme!!!!
Me urge, si tienen respuestas envienmelas a [email protected] porfavor.

Este es el codigo

''---------------------------Boton de mostrar datos del dia-------------------------------------------

If Text21.Text = "" Then
MsgBox "Please specify the work directory first!", vbInformation
Text21.SetFocus

GoTo salida
End If
dirpos = "c: eportplus eports"
dp = dirpos
dp = dp & "" & Text21.Text & ""
dirdata = "c:Proyecto REportPlus eportplusdata"
Dim oCncua As ADODB.Connection
Dim oRscua As ADODB.Recordset
Set oCncua = New ADODB.Connection
Set oRscua = New ADODB.Recordset

oCncua.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & dirdata & "rpdatabase.mdb"
oRscua.Open "translator", oCncua, adOpenKeyset, adLockOptimistic, adCmdTable
ssr = MsgBox("Start new day?", vbYesNo)

If Val(ssr) = 7 Then GoTo saltox

While Not oRscua.EOF
oRscua.Delete
oRscua.MoveNext
Wend
saltox:
'MsgBox ("Dir=" & dirpos & "ssr= " & ssr)

'--------------------------------------------------proceso ya que esta vacio el archivo

varcash = "1" ' rs!cash
grilla1.Visible = True
'abre el archivo de pos
'dp = "c:ootdrvaloha" & dp
Set Cnfox = New ADODB.Connection
Cnfox.ConnectionString = "Provider=MSDASQL.1;" & _
"Persist Security Info=False;" & _
"Extended Properties=Driver={Microsoft Visual FoxPro Driver};" & _
"UID=;SourceDB=" & dp & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;" & _
"Collate=Machine;Null=Yes;Deleted=Yes;"
Cnfox.Open
'On Error GoTo salexerror

Set Rsfox = New ADODB.Recordset
On Error GoTo salexerror
Rsfox.Open "select * from gndtndr where type=1", Cnfox, adOpenForwardOnly, adLockReadOnly
'ahora abre el correspondiente para buscar las formas de pago
Set cnfox2 = New ADODB.Connection
cnfox2.ConnectionString = "Provider=MSDASQL.1;" & _
"Persist Security Info=False;" & _
"Extended Properties=Driver={Microsoft Visual FoxPro Driver};" & _
"UID=;SourceDB=" & dp & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;" & _
"Collate=Machine;Null=Yes;Deleted=Yes;"
cnfox2.Open
Set rsfox2 = New ADODB.Recordset
rsfox2.Open "select * from tdr", Cnfox, adOpenForwardOnly, adLockReadOnly

With grilla1
'.Rows = 1
'.Clear


.ColWidth(1) = 1200
.ColWidth(2) = 1400
.ColWidth(3) = 1200
.ColWidth(4) = 1400
.MergeCells = 2
.MergeCol(0) = True
.MergeCol(1) = False
.MergeCol(2) = False
.MergeCol(3) = False
.MergeCol(4) = False
.MergeCol(5) = False

.TextMatrix(0, 0) = "Check"
.TextMatrix(0, 1) = "Amount"
.TextMatrix(0, 2) = "Revenue Center"
.TextMatrix(0, 3) = "Employee ID"
.TextMatrix(0, 4) = "Type of payment"
.TextMatrix(0, 5) = "Payment Number"
.TextMatrix(0, 6) = "Control ID"
.TextMatrix(0, 7) = "Unique ID"
End With


While Not Rsfox.EOF



amountf = Format(Rsfox!amount, "#####0.00")

tcheque = tcheque + Rsfox!amount

'determina la forma de pago del cheque para mostrarlo en la grilla

If rsfox2.EOF = True Then
rsfox2.MoveFirst
End If
While Not rsfox2.EOF = True
If rsfox2!usernumber = Rsfox!typeid Then
descrip = rsfox2!Name
End If
rsfox2.MoveNext
Wend
'If rsfox!check <> elche1 And amountf <> lacan1 And rsfox!typeID <> eltipo1 Then
'va a ver si ya esta el cheque agregado
vali = Rsfox!CHECK
'If vali = "20012" Then Stop
sita = 0
For ffg = 1 To x

If grilla1.TextMatrix(ffg, 0) = vali Then sita = 1
Next ffg
MsgBox (vali)
'If sita = 0 And Rsfox!typeid = "1" Then
'If sita = 0 Then

'va a revisar que no existan mas formas de pago que efectivo
'GoTo sigggg
Set Cnfoxz = New ADODB.Connection
Cnfoxz.ConnectionString = "Provider=MSDASQL.1;" & _
"Persist Security Info=False;" & _
"Extended Properties=Driver={Microsoft Visual FoxPro Driver};" & _
"UID=;SourceDB=" & dp & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;" & _
"Collate=Machine;Null=Yes;Deleted=Yes;"
Cnfoxz.Open

Set rsfoxz = New ADODB.Recordset
rsfoxz.Open "select * from gndtndr where type=1", Cnfoxz, adOpenForwardOnly, adLockReadOnly
While Not rsfoxz.EOF
'If rsfoxz!Check = "60040" Then Stop

If rsfoxz!CHECK = Rsfox!CHECK Then

tipo = rsfoxz!typeid
'If tipo <> "1" And rsfoxz!Type = "1" Then bann1 = "no"

End If
rsfoxz.MoveNext
Wend
'quita las cortesias

'If Len(Rsfox!ID) > 2 Then bann1 = "no"

If bann1 = "no" Then GoTo saltarin
'...............................
sigggg:

With grilla1
grilla1.AddItem ""
x = x + 1
.TextMatrix(x, 0) = Rsfox!CHECK
.TextMatrix(x, 1) = amountf
.TextMatrix(x, 2) = Rsfox!revenue
.TextMatrix(x, 3) = Rsfox!employee
.TextMatrix(x, 4) = descrip
.TextMatrix(x, 5) = Rsfox!typeid
.TextMatrix(x, 6) = Int(Rsfox!CHECK)
.TextMatrix(x, 7) = Rsfox!ID
End With

elche1 = Rsfox!CHECK
lacan1 = amountf
eltipo1 = Rsfox!typeid
lacanxxx = lacanxxx + lacan1
If varcash = grilla1.TextMatrix(x, 5) Then
varcsum = varcsum + Val(grilla1.TextMatrix(x, 1))
End If
'End If
saltarin:
bann1 = ""

Rsfox.MoveNext

ffg = 0
Wend
tr = "ok"
'por defaul acomoda por numero de cheque
Command2.Enabled = False
Text1.Text = x

Text2.Text = FormatNumber(tcheque, 2)
Text3.Text = FormatNumber(varcsum, 2)
'vuelve a sumar por que resulta que no cuadra al inicio
For tt = 1 To x
elch = grilla1.TextMatrix(tt, 0)
If Left(elch, 1) = "*" Then
totef = totef + Val(grilla1.TextMatrix(tt, 1))
tcount = tcount + 1
Else
totno = totno + Val(grilla1.TextMatrix(tt, 1))
tcountno = tcountno + 1
End If
Next tt
Text3.Text = FormatNumber(totno, 2)
Text5.Text = FormatNumber(totef, 2)
Text4.Text = tcount
Text1.Text = tcountno

ok1 = 1
grilla1.TextMatrix(x + 1, 0) = "999999"
grilla1.RemoveItem (x + 1)
salida:
If Err <> 0 Then
MsgBox "An error has ocurred, the description is :" & Error & " Please check configuration."

End If
salexerror:

xt = Err
If xt = "-2147217865" Then
MsgBox "That Path doesn`t exist, please verify!"
Text21.SetFocus
End If


grilla1.Sort = 1
End Sub
''---------------------------Termina Boton mostrar datos del dia-----------------------------------------
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder