' Description: Look for fractal images and upgrade any that are found.
Dim iRec,nRecs,nImgs,nFractals
nFractals=0
nImgs=0

Sub UpdateStatus
StatusText="" & iRec & "/" & nRecs & ": " & nImgs & " scanned, " & nFractals & " fractal."
End Sub

Set recs=Database.AllRecords
nRecs=recs.Count
For iRec=1 To nRecs
 Set rec=recs(iRec)
 Set imgs=rec.Images
 bEditing=0
 n=imgs.Count
 For i=1 to n
  Set img=imgs(i)
  nImgs=nImgs+1
  If img.IsFractal Then
    If bEditing=0 Then
      rec.Edit
      bEditing=1
      End If
    imgs.Add img.Picture
    imgs.MoveFromTo imgs.Count,i
    imgs.MoveFromTo i+1,imgs.Count
    imgs.Remove imgs.Count
    nFractals=nFractals+1
    UpdateStatus
   End If
  Next
 If bEditing Then
   rec.Save
   End If
 UpdateStatus
 Next
MsgBox "Records scanned: " & nRecs & vbCrLf & "Images scanned: " & nImgs & vbCrLf & "Fractal images converted:" & nFractals

