Open file dialog box problem

G

Guest

I've created a form that displays images using VBA script and stores the
relative path of the image as text. I want to use a command button that
imports the relative path of the images similar to a browse button. I've
tried the following method: http://support.microsoft.com/kb/824272. Although
it works perfectly in the Northwind database, it displays an error message
"Compile error. User-defined type not defined" when I use it in mine. Any
ideas? Or if anyone knows how to create relative paths from absolute ones I
would be grateful.
 
S

Scott McDaniel

I've created a form that displays images using VBA script and stores the
relative path of the image as text. I want to use a command button that
imports the relative path of the images similar to a browse button. I've
tried the following method: http://support.microsoft.com/kb/824272. Although
it works perfectly in the Northwind database, it displays an error message
"Compile error. User-defined type not defined" when I use it in mine. Any
ideas? Or if anyone knows how to create relative paths from absolute ones I
would be grateful.

Do you have a reference to the Microsoft Office 11.0 Object Library set in your project?

What exactly do you mean by relative and absolute ... I'm aware of their general meanings, but many people have a
different concept of them.

If you're receiving an error please indicate the Line on which the error occurs.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
G

Guest

Well, yes I've already checked that the Microsoft Office 11.0 Object Library
set is active. The problem appears in the third line: Dim fDialog As
Office.FileDialog
By relative I mean a path that looks like this: Pics\image1.jpg
and absolute a path that looks like this: C:\Documents and
Settings\User\Desktop\Database\Pics\image1.jpg

Do you think that there might be a problem with the rest of the code I use
 
D

Douglas J. Steele

That really does sound as though the Office library hasn't been selected.
You sure it's Microsoft Office 11.0 Object Library you've selected, and not
Microsoft Access 11.0 Object Library, or some other library?

In any case, you can avoid all the references problems by using the code at
http://www.mvps.org/access/api/api0001.htm at "The Access Web" instead.
 
G

Guest

Well, you were right it was tha access library I've checked, not the Office
one. Thank you. Does anyone know how I could create relative paths using the
ones I get from the open dialog box? I want to include some photos in the
database folder, but I don't want to use the whole path because I want the
links to work even when I use my database in another computer.
 
D

Douglas J. Steele

Already answered in another thread where you posted the same question. (As I
said there, Access doesn't really support relative paths)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top