I need to rename about 8000 files using field names from my database (actual names are [Image1] to [Image2]). I'm using the below code but it keeps giving me error messages on the Name As function. It can do 1 record (and sometimes up to 5 or 6) at a time but I'm trying to get it to loop until it hits the last record. The below code is based on the last record containing "zzzzzzzzz" as the last entry for field [title]. There may be a better way of going about this and I'm completely up to any suggestions. I "learned" some VBA just this last week in my Access database management class, so I'm now trying to put it to use, so be gentle! Here is the code I've used, let me know what I'm doing wrong:
Private Sub Rename_Button_Click()
Dim thisislastrecord As Boolean
thisislastrecord = False
Do
Name [Image1] As [Image2]
SendKeys "{PGDN}", 100
If [Title] = "zzzzzzzzz" Then
thisislastrecord = True
End If
Loop Until thisislastrecord = True
End Sub
Private Sub Rename_Button_Click()
Dim thisislastrecord As Boolean
thisislastrecord = False
Do
Name [Image1] As [Image2]
SendKeys "{PGDN}", 100
If [Title] = "zzzzzzzzz" Then
thisislastrecord = True
End If
Loop Until thisislastrecord = True
End Sub