RecordSet ODBC To SQLIte

I have the following method, the FileMaker database with 5795 records, are exported to a Sqlite database. When I run the method only reaches the 1339 record and the program quits unexpectedly, I imagine there is a memory overflow.

  If mDB Is Nil Then Return
  Dim sql As String
  sql = "SELECT IDPaciente, Fecha, Hallazgos, Diagnostico, ProximaCita, GetAS(Img, 'JPEG') As Foto1, GetAS(Img2, 'JPEG') As Foto2, GetAS(Img3, 'JPEG') As Foto3, GetAS(Img4, 'JPEG') As Foto4, GetAS(Img5, 'JPEG') As Foto5, GetAS(Img6, 'JPEG') As Foto6  FROM Imagenes"
  Dim rs As RecordSet
  rs = mDB.SQLSelect(sql)
  If mDB.Error Then
    MsgBox("DB Error: " + mDB.ErrorMessage)
  End If
  If rs <> Nil Then
    While Not rs.EOF
      IMGCrear(rs.Field("IDPaciente").StringValue, rs.Field("Fecha").StringValue, rs.Field("Hallazgos").StringValue,  rs.Field("Diagnostico").StringValue,  rs.Field("ProximaCita").StringValue, rs.Field("Foto1").Value, rs.Field("Foto2").Value, rs.Field("Foto3").Value, rs.Field("Foto4").Value, rs.Field("Foto5").Value, rs.Field("Foto6").Value)
    MsgBox "ok"
  End If

  Dim row As New DatabaseRecord
  row.Column("img_ID") = Str(IMGID)
  row.Column("paciente_ID") = paciente
  row.Column("img_creacion") = creacion
  row.Column("img_contenido") = hallazgos
  row.Column("img_dx1") = dx
  row.Column("img_dx2") = cita
  row.BlobColumn("img_foto1") = pic1
  row.BlobColumn("img_foto2") = pic2
  row.BlobColumn("img_foto3") = pic3
  row.BlobColumn("img_foto4") = pic4
  row.BlobColumn("img_foto5") = pic5
  row.BlobColumn("img_foto6") = pic6
  row.Column("img1n") = "Foto.JPG"
  row.Column("img2n") = "Foto.JPG"
  row.Column("img3n") = "Foto.JPG"
  row.Column("img4n") = "Foto.JPG"
  row.Column("img5n") = "Foto.JPG"
  row.Column("img6n") = "Foto.JPG"
  App.iDADB.InsertRecord("imagenes", row)
  If App.iDADB.Error Then
    MsgBox("DB Error: " + App.iDADB.ErrorMessage)
  End If

Can you give me an example of how to create a percentage bar that shows from 0 to 100% the complete percentage of the recordset, how can I insert all the records?

The problem is that the program closes

create a new variable that counts where you are in the loop

if theCounter=1339 then break

and steps through the program to see exactly where the app quits.

pretty sure the database record at that place has some uncommon values.