I have a form where users add pictures using folder creating and placing pictures in those folders. Folder and file names are based of textboxes in the form.
For editing I made a form where they can change data in those textboxes and update the folder and file names.
I wrote code for this but when I run it i get Run-time error '53': File not found.
The file location is correct but I think the problem is renaming folders, but I dont have the solution.
To explain the code.
The GetLink1 creates a part of a full (the folder naming part) link to the image. It uses data from the textboxes to make it. This here creates the new part of the link with new changes made in textboxes.
LinkVo adds the location of the database to the new updated link.
GetPic1 creates the new name of the picture.
GetFullPic1 is the full link of the new names of folders and picture.
OldLink1 contains the old full link of the folders and links (TxtUrlPic1 is a textbox that contains the part of the old link).
I used Name function to try to change the folder and file names but I get this error above. I checked with ?OldLink1 and ?GetFullPic1. The links are correct but it doesnt want to rename. Any ideas?
For editing I made a form where they can change data in those textboxes and update the folder and file names.
I wrote code for this but when I run it i get Run-time error '53': File not found.
The file location is correct but I think the problem is renaming folders, but I dont have the solution.
To explain the code.
The GetLink1 creates a part of a full (the folder naming part) link to the image. It uses data from the textboxes to make it. This here creates the new part of the link with new changes made in textboxes.
LinkVo adds the location of the database to the new updated link.
GetPic1 creates the new name of the picture.
GetFullPic1 is the full link of the new names of folders and picture.
OldLink1 contains the old full link of the folders and links (TxtUrlPic1 is a textbox that contains the part of the old link).
I used Name function to try to change the folder and file names but I get this error above. I checked with ?OldLink1 and ?GetFullPic1. The links are correct but it doesnt want to rename. Any ideas?
Code:
Dim GetLink1 As String
Dim LinkVo As String
Dim GetPic1 As String
Dim GetFullPic1 As String
Dim OldLink1 As String
If IsNull(MarkVeh & ModVeh & TipMot) Then
Exit Sub
End If
GetLink1 = "\BASE DATAS\" & MarkVeh & "\" & ModVeh & " " & TipMot & " - " & VlasVeh & " " & TelMob & " (" & KorVoz & " - " & KorTelMob & ")"
LinkVo = CurrentProject.Path & GetLink1
OldLink1 = CurrentProject.Path & Me.TxtUrlPic1.Value
GetPic1 = "\" & MarkVeh & " " & ModVeh & " " & TipMot & " - " & VlasVeh & " (" & KorVoz & ")(1).jpg"
GetFullPic1 = LinkVo & GetPic1
If IsNull(TxtUrlPic1) Then
Exit Sub
End If
If GetFullPic1 = OldLink1 Then
Exit Sub
Else
Name OldLink1 As GetFullPic1
End If
Me.UrlMapePD.Value = GetLink1
Me.TxtUrlPic1.Value = GetLink1 & GetPic1