473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Finding Images in FileName\Image

I'm trying to move my images from my main folder to an image folder for the
database to store pictures of animals. I borrowed code that works great if I
put all the images in the main folder where the db is located. I would like to
move them to their own folder and I don't know where to begin.

here is the code:

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

_______________________

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImageAn.Picture = pathname & Me.Breed & ".jpg"

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox err.Description
Resume Exit_cmdClose_Click
End If
End Sub

Any help would be greatly appreciated.

Michael
Nov 12 '05 #1
3 1941
Lumpierbritches wrote:
I'm trying to move my images from my main folder to an image folder for the
database to store pictures of animals. I borrowed code that works great if I
put all the images in the main folder where the db is located. I would like to
move them to their own folder and I don't know where to begin.

here is the code:

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

_______________________

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImageAn.Picture = pathname & Me.Breed & ".jpg"

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox err.Description
Resume Exit_cmdClose_Click
End If
End Sub

Any help would be greatly appreciated.

Michael


Me.ImageAn.Picture = pathname & "images\" & Me.Breed & ".jpg"

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #2
Trevor Best wrote:
Err_cmdClose_Click:
If err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox err.Description
Resume Exit_cmdClose_Click
End If


A nice touch would be to create a bitmap with a red X on it, a la IE
broken pic, then set the picture to that if it doesn't exist.

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #3
Thank you for all the suggestions and the fix, I greatly appreciate it.

Michael
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matthew Robinson | last post by:
Can anybody see what is wrong with this code? apparently i have an 'empty delimiter' on the line that sets $pos - can anybody see what is wrong with it? $search_for = $_GET;...
1
by: Yang | last post by:
I want to list all images from a url. here is my code snippet which finds an image from a url: $url = "http://asdf.com/"; $text = @implode("", file($url)); while (eregi("*(src)*=*(+)",...
3
by: Lumpierbritches | last post by:
I'm trying to move my images from my main folder to an image folder for the database to store pictures of animals. I borrowed code that works great if I put all the images in the main folder where...
0
by: KoolistOne | last post by:
On Win9x, IE 6, I need to 1. Find all the images on a given web page 2. Determine whether or not they resolved and are showing up. (i.e. no error page or small red X) so, what's the best way to...
1
by: Rico | last post by:
Hello, I have an ole object field (Access XP/2002) which I store images in. I have a couple of questions regarding this; is it possible to determine the image dimensions? Secondly, is there...
0
by: U S Contractors Offering Service A Non-profit | last post by:
This Sunday the 26th 2006 there will be Music @ Tue Nov Inbox Reply Craig Somerford to me show details 9:54 pm (26 minutes ago) #1St "CLICK" HeAt frOm A blanket...
1
by: lejason | last post by:
Hi, I have an XML file that is a list of product models and info. The list will eventually contain about 100 products, each product having multiple elements for things like names,...
3
by: Cartoper | last post by:
My application appears to have a recourse leak. When the user starts a background process, the handle count in Process Explorer (PE) goes up by about 10, sometime 1 or 2 more, sometimes 1 or 2...
7
by: Nick | last post by:
Hi there, I have a website that functions fine locally, but when published to the server it develops a bottleneck during loading some of the pages. Basically what happens is the page loads to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.