If rs.EOF = True And rs.BOF = True Then
Else
Do While rs.EOF = False
rs.MoveFirst
mes = rs.Fields("periodo_mes").Value
año = rs.Fields("periodo_año").Value
rif = rs.Fields("rif_contribuyente").Value
factura = rs.Fields("n_factura").Value
Control = rs.Fields("n_control").Value
monto = rs.Fields("monto_retencion").Value
porcentaje = rs.Fields("porcentaje").Value
'abrimos el archivo con FSO para escribir el documento xml
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ofich = FSO.CreateTextFile(rutacompleta, True)
variable = "<?xml version =" & Chr(34) & "1.0" & Chr(34) & " encoding =" & Chr(34) & "utf-8" & Chr(34) & "?>"
ofich.writeline (variable)
ofich.writeline ("<RelacionRetencionesISRL RifAgente=" & Chr(34) & "J002938897" & Chr(34) & " Periodo=" & Chr(34) & & mes & & año & & Chr(34) & ">")
ofich.Close
Set ofich = Nothing
rs.MoveNext
Loop
rs = Nothing
End If
