If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Rename Image File - Skip
Access 2000.
Windows 2000 Pro and Windows XP Pro Desktops. I have a subform (on a form) that displays a tif image. As I rename the image, the image is renamed and moved to another file location and the next image is displayed for me to rename. So far this works correctly. The problem that I am having is that sometimes I come across an image that I do not want to rename (and move). How do I move to the next image? It seems as though the order the images are being selected are by the date it was created. Basically, I would like to "skip" (or disregard) the current image and move to the next. Could someone please let me know if this is even possible and how I should go about solving this problem? Here is a short version of what I have... Private Sub cmdRenameFile_Click() Dim strSourcePath As String Dim strDestinationPath As String Dim strExt As String Dim strDir As String strSourcePath = "\\ServerName\Images\" strDestinationPath = "\\ServerName\Images\Renamed\" strExt = ".tif" strOldName = strSourcePath & txtCurrentName strNewName = strDestinationPath & cboNewName & strExt ‘Rename the file. Name strOldName As strNewName ‘Get the next file. strDir = Dir(strSourcePath & "*.tif") Forms!Rename_Files_frm!Rename_Files_subfrm.Form.im gDocument.Picture = strSourcePath & strDir txtCurrentName = strDir cboNewName = "" End Sub Thank you in advance for any and all help. j.t.w |
#2
|
|||
|
|||
'Rename the file.
Name strOldName As strNewName See if this will help: 'Rename the file. If Nz(cboNewName, "") "" Then Name strOldName As strNewName End If If desired, you could add an Else statement to the If to pop-up a message box verifying that cboNewName wasn't left blank by accident and retry if it was. -- Wayne Morgan MS Access MVP "j.t.w" wrote in message om... Access 2000. Windows 2000 Pro and Windows XP Pro Desktops. I have a subform (on a form) that displays a tif image. As I rename the image, the image is renamed and moved to another file location and the next image is displayed for me to rename. So far this works correctly. The problem that I am having is that sometimes I come across an image that I do not want to rename (and move). How do I move to the next image? It seems as though the order the images are being selected are by the date it was created. Basically, I would like to "skip" (or disregard) the current image and move to the next. Could someone please let me know if this is even possible and how I should go about solving this problem? Here is a short version of what I have... Private Sub cmdRenameFile_Click() Dim strSourcePath As String Dim strDestinationPath As String Dim strExt As String Dim strDir As String strSourcePath = "\\ServerName\Images\" strDestinationPath = "\\ServerName\Images\Renamed\" strExt = ".tif" strOldName = strSourcePath & txtCurrentName strNewName = strDestinationPath & cboNewName & strExt 'Rename the file. Name strOldName As strNewName 'Get the next file. strDir = Dir(strSourcePath & "*.tif") Forms!Rename_Files_frm!Rename_Files_subfrm.Form.im gDocument.Picture = strSourcePath & strDir txtCurrentName = strDir cboNewName = "" End Sub Thank you in advance for any and all help. j.t.w |
#3
|
|||
|
|||
Wayne,
Thanks for your response. I understand that the "If" statement will skip the renaming of the file, but what I would like to do next is move to the next tif file in the directory without having to do anything with the current tif file. Example of contents in the directory (in this order): SCN_11111111111.tif SCN_22222222222.tif SCN_33333333333.tif SCN_44444444444.tif etc. Currently, when I rename and move the files as they are being displayed, the next image gets displayed where I can then rename that one. How would I go about looping through the directory and skipping the "SCN_33333333333.tif" image and then move on to the "SCN_44444444444.tif"? Note: Prior to the file being displayed, I wouldn't neccessarily look at or know what image I would like to skip until that time. Anyway, hopefully I explained this well enough. Please let me know if you need more information. Thanks. j.t.w |
#4
|
|||
|
|||
On subsequent calls of Dir, if you use no arguments, you'll get the next
file in line. So, you need to know if you've been through once already. In your case, you could probably use the fact the txtCurrentName has a file name in it instead of the "flag" variable that I've used. I assume txtCurrentName would be blank until you get the first file. Example: Private Sub Command3_Click() Static bolBeenHere As Boolean If bolBeenHere Then Me.Text4 = Dir Else Me.Text4 = Dir("c:\windows\*.*") End If bolBeenHere = True End Sub -- Wayne Morgan MS Access MVP "j.t.w" wrote in message om... Wayne, Thanks for your response. I understand that the "If" statement will skip the renaming of the file, but what I would like to do next is move to the next tif file in the directory without having to do anything with the current tif file. Example of contents in the directory (in this order): SCN_11111111111.tif SCN_22222222222.tif SCN_33333333333.tif SCN_44444444444.tif etc. Currently, when I rename and move the files as they are being displayed, the next image gets displayed where I can then rename that one. How would I go about looping through the directory and skipping the "SCN_33333333333.tif" image and then move on to the "SCN_44444444444.tif"? Note: Prior to the file being displayed, I wouldn't neccessarily look at or know what image I would like to skip until that time. Anyway, hopefully I explained this well enough. Please let me know if you need more information. Thanks. j.t.w |
#5
|
|||
|
|||
Thanks Wayne,
I'll give that a try. j.t.w "Wayne Morgan" wrote in message ... On subsequent calls of Dir, if you use no arguments, you'll get the next file in line. So, you need to know if you've been through once already. In your case, you could probably use the fact the txtCurrentName has a file name in it instead of the "flag" variable that I've used. I assume txtCurrentName would be blank until you get the first file. Example: Private Sub Command3_Click() Static bolBeenHere As Boolean If bolBeenHere Then Me.Text4 = Dir Else Me.Text4 = Dir("c:\windows\*.*") End If bolBeenHere = True End Sub -- Wayne Morgan MS Access MVP "j.t.w" wrote in message om... Wayne, Thanks for your response. I understand that the "If" statement will skip the renaming of the file, but what I would like to do next is move to the next tif file in the directory without having to do anything with the current tif file. Example of contents in the directory (in this order): SCN_11111111111.tif SCN_22222222222.tif SCN_33333333333.tif SCN_44444444444.tif etc. Currently, when I rename and move the files as they are being displayed, the next image gets displayed where I can then rename that one. How would I go about looping through the directory and skipping the "SCN_33333333333.tif" image and then move on to the "SCN_44444444444.tif"? Note: Prior to the file being displayed, I wouldn't neccessarily look at or know what image I would like to skip until that time. Anyway, hopefully I explained this well enough. Please let me know if you need more information. Thanks. j.t.w |
#6
|
|||
|
|||
Thanks Wayne,
I'll give that a try. j.t.w "Wayne Morgan" wrote in message ... On subsequent calls of Dir, if you use no arguments, you'll get the next file in line. So, you need to know if you've been through once already. In your case, you could probably use the fact the txtCurrentName has a file name in it instead of the "flag" variable that I've used. I assume txtCurrentName would be blank until you get the first file. Example: Private Sub Command3_Click() Static bolBeenHere As Boolean If bolBeenHere Then Me.Text4 = Dir Else Me.Text4 = Dir("c:\windows\*.*") End If bolBeenHere = True End Sub -- Wayne Morgan MS Access MVP "j.t.w" wrote in message om... Wayne, Thanks for your response. I understand that the "If" statement will skip the renaming of the file, but what I would like to do next is move to the next tif file in the directory without having to do anything with the current tif file. Example of contents in the directory (in this order): SCN_11111111111.tif SCN_22222222222.tif SCN_33333333333.tif SCN_44444444444.tif etc. Currently, when I rename and move the files as they are being displayed, the next image gets displayed where I can then rename that one. How would I go about looping through the directory and skipping the "SCN_33333333333.tif" image and then move on to the "SCN_44444444444.tif"? Note: Prior to the file being displayed, I wouldn't neccessarily look at or know what image I would like to skip until that time. Anyway, hopefully I explained this well enough. Please let me know if you need more information. Thanks. j.t.w |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how do i paste a jpeg file onto microsoft word | endoaccess | General Discussion | 23 | September 8th, 2004 04:11 AM |
Upload Image | Jason MacKenzie | General Discussion | 1 | September 1st, 2004 04:38 AM |
Jet35.sp3 | doglover | Database Design | 3 | August 26th, 2004 04:41 PM |
Importing pst file doesn't bring in my calendar and contacts | Jackie | Contacts | 6 | August 5th, 2004 02:40 AM |
GPO Office 2003 | Tony | Setup, Installing & Configuration | 1 | May 12th, 2004 10:42 AM |