Display Photo in Form using Relative Path

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a database that uses an image frame to display a photo in my form. I
converted my database to Access 97 and now am getting a few errors. First,
97 did not like "CurrentProject.FullPath", so I changed it to
"CurrentDB.Name". This then spawned an error at the InStrRev function, so I
changed it to just InStr. Now I get a message that says "13 Type Mismatch"
whenever I try to move between records. And of course, the photo's don't
show up. Should I resign myself to having to type in the full path for the
photos? Any ideas on making relative paths work?
Thanks,
Melinda
PS: Here's the chunk of code in question.

(strImagePath, 1) = "\" Then
' Path is relative
strDatabasePath = CurrentDb.Name
intSlashLocation = InStr(strDatabasePath, "\",
Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
 
Yep, the FullPath is gone. Name returns the same thing.
Don't know why you had a problem with the InStrRev(), I tried it and it
worked just fine. What error did you get?

What are you trying to do here?

intSlashLocation = InStr(strDatabasePath, "\", Len(strDatabasePath))

The 3rd argument is Compare type. Must be left over from the InStrRev.

Before you chuck the whole thing. go back and try working through it in
debug mode.
 
Access 97 doesn't have InStrRev, Klatuu: that was introduced in Access 2000.

If the intent is to derive the folder from the full name, use:

Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
 
Guess I forgot that. It has been over 4 yrs since I worked in 97.
I like your technique for getting the path name.
 
Thanks Doug,
Your suggested pointed me in the right direction. The only problem now is
that Access claims it doesn't support jpegs. Oh, well. I guess I'll have to
use the XP machine for this db.
Thanks,
Melinda
 
Back
Top