Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically load image into form - path question 1

Status
Not open for further replies.

FTC

Technical User
Apr 3, 2001
8
0
0
GB
I'm loading pictures automatically onto a form using the code from FAQ in this forum. Excellent - but one problem! I've stored the images as follows, eg, d:\artefact collection\artefact images\1987\87.123.jpg, putting images for each year in a folder of that name.(The picture name is the same as the ID number on the form - 87.123 in this case). Is there a way of getting Access to deduce the name of the year folder from the 87.123?
Or would it be best just to get rid of the year subfolders?
Thanks!
Fiona
 
You could use the InStr() function to find the "." in your picture string, and then use the Mid() function to grab the 2 characters to the left of that. You will have to do some playing to get it to work right, especially in the area of determining if it is going to be 1901 or 2001, but you should be able to do it.

Actually, rereading your post, if the picture name is consistantly in the format of "87.123", you could just use the Left() function to grab the first two characters, test for your millineum change and build your path string:
Code:
path = "d:\artefact collection\artefact images\" & _
       IIF (CInt(Left(YourFileName, 2) > 50) "19", "20") & _
       Left(YourFileName, 2) & "\" & _
       YourFileName
I didn't test this, but it should be close...

If you can't get it to work right, post your attempt here and we can get you through it. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Hello Terry,
Thank you very much - works 100% and will save many days of typing in image pathnames! Just to add, images/ID numbers from 2000 on are recorded as 2000.123 etc, and there are also a few miscellaneous number systems such as t234, DB513 etc.

Still a couple of other things not working properly, seemingly related to including images.
1. If I move quickly through the records in form view, an 'illegal operation...will be shut down' message appears - 'MSACCESS caused an invalid page fault in module KERNEL32.DLL at 0137:bff76771.

2. Snapshot refuses to export or send a report with the images included - gets as far as Page 1 then closes without so much as a message.

Any suggestions on how to get round these problems would be very much appreciated,
Thanks,
Fiona :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top