|  | Check if an external file exists |  | |
| | | Wayne-I-M |  |
| Posted: Wed Sep 24, 2008 6:34 am Post subject: Check if an external file exists |  |
Hi
I have a form/reports showing photos of clients (for ski lift passes). I also have a check box showing if the photo has been recieved.
The photos are in a folder on the server.
table = ID Name address etc etc The photos are called the same as the ID
So person with an ID of 123 has a photo called 123.jpg - 456 has 456.jpg - etc
P:\ski_2009_photos\123.jpg
This all works fine.
Question is it possible to "check" the box if the file exists in the external folder
So if I load in a photo 789.jpg for person 789 then the PhotoRecieved check box is updated in record ID789 - I can do the updating bit its just the referencing to (possibly) non-existant files that I'm have problems with. Any ideas??
Thank you
-- Wayne Manchester, England. |
| |
| | | TopJB |  |
| Posted: Wed Sep 24, 2008 6:54 am Post subject: Re: Check if an external file exists |  |
Hi
You can use method FileExists
Set fs = CreateObject("Scripting.FileSystemObject") If fs.FileExists("[Path to file]") Then MsgBox "ok" Else MsgBox "not ok" End If
Wayne-I-M a écrit :
| Quote: | Hi
I have a form/reports showing photos of clients (for ski lift passes). I also have a check box showing if the photo has been recieved.
The photos are in a folder on the server.
table = ID Name address etc etc The photos are called the same as the ID
So person with an ID of 123 has a photo called 123.jpg - 456 has 456.jpg - etc
P:\ski_2009_photos\123.jpg
This all works fine.
Question is it possible to "check" the box if the file exists in the external folder
So if I load in a photo 789.jpg for person 789 then the PhotoRecieved check box is updated in record ID789 - I can do the updating bit its just the referencing to (possibly) non-existant files that I'm have problems with. Any ideas??
Thank you
|
|
| |
| | | Steve Schapel |  |
| Posted: Wed Sep 24, 2008 7:23 am Post subject: Re: Check if an external file exists |  |
Wayne,
Test for: Len(Dir("P:\ski_2009_photos\" & [ID] & ".jpg"))
-- Steve Schapel, Microsoft Access MVP
Wayne-I-M wrote:
| Quote: | Hi
I have a form/reports showing photos of clients (for ski lift passes). I also have a check box showing if the photo has been recieved.
The photos are in a folder on the server.
table = ID Name address etc etc The photos are called the same as the ID
So person with an ID of 123 has a photo called 123.jpg - 456 has 456.jpg - etc
P:\ski_2009_photos\123.jpg
This all works fine.
Question is it possible to "check" the box if the file exists in the external folder
So if I load in a photo 789.jpg for person 789 then the PhotoRecieved check box is updated in record ID789 - I can do the updating bit its just the referencing to (possibly) non-existant files that I'm have problems with. Any ideas??
Thank you
|
|
| |
| | | Wayne-I-M |  |
| Posted: Wed Sep 24, 2008 7:58 am Post subject: Re: Check if an external file exists |  |
| |  | |
Many thanks to you both - did a mix-n-match (bit of both answers) and it works fine
Private Sub butPhotoChecker_Click() If Dir("P:\ski_2009_photos\" & [CDClientID] & ".jpg") <> "" Then Me.qryBookings!PhotoReceived = -1 DoCmd.OpenQuery "qryUpdatePhotoRecieved", acViewNormal, acEdit Else MsgBox "Photo does not exist" End If End Sub
Thanks again
-- Wayne Manchester, England.
"Steve Schapel" wrote:
| Quote: | Wayne,
Test for: Len(Dir("P:\ski_2009_photos\" & [ID] & ".jpg"))
-- Steve Schapel, Microsoft Access MVP
Wayne-I-M wrote: Hi
I have a form/reports showing photos of clients (for ski lift passes). I also have a check box showing if the photo has been recieved.
The photos are in a folder on the server.
table = ID Name address etc etc The photos are called the same as the ID
So person with an ID of 123 has a photo called 123.jpg - 456 has 456.jpg - etc
P:\ski_2009_photos\123.jpg
This all works fine.
Question is it possible to "check" the box if the file exists in the external folder
So if I load in a photo 789.jpg for person 789 then the PhotoRecieved check box is updated in record ID789 - I can do the updating bit its just the referencing to (possibly) non-existant files that I'm have problems with. Any ideas??
Thank you
|
|
| |
|
|