Timing Text to return file name only

  • Thread starter Thread starter Gary Hull
  • Start date Start date
G

Gary Hull

I am using a text box to store File name and drictoryu for photos I use in
my DB, I would like to put a control on my form and report that would
return the file name only.

What would be the best way to do this?

Thanks

Gary Hull
 
Try using =Dir(FullPathToFile) as its ControlSource

I does't seem to work

This is what I used in the control source of the tex box
Dir(C:\photos) I get a #Name? error in the text bos
 
Dir("C:\photos")

Gary Hull said:
I does't seem to work

This is what I used in the control source of the tex box
Dir(C:\photos) I get a #Name? error in the text bos
 
Gary Hull said:
I does't seem to work

This is what I used in the control source of the tex box
Dir(C:\photos) I get a #Name? error in the text bos

As Klatuu pointed out, you need quotes around it.

However, I may have misinterpretted what you're trying to do.

I thought you had the full path already (folder and file name), and you
wanted strictly the file name.

Dir("C:\photos\photo1.jpg") will give you photo1.jpg

Are you actually trying to get a list of files within the folder?
 
As Klatuu pointed out, you need quotes around it.

However, I may have misinterpretted what you're trying to do.

I thought you had the full path already (folder and file name), and you
wanted strictly the file name.

Dir("C:\photos\photo1.jpg") will give you photo1.jpg

Are you actually trying to get a list of files within the folder?

This is what I am trying to do

It is the same setup that the northwind dB use to show employee photos
When I click a button it opens an office directory box, from there I
select the file name of the photo that I need. The Photo is displayed in
the form or report. I have a text box on the form or report that displays
the path and file name I wish to remove every thing except the file name.
The path and file name are stored in a table
 
Gary Hull said:
This is what I am trying to do

It is the same setup that the northwind dB use to show employee photos
When I click a button it opens an office directory box, from there I
select the file name of the photo that I need. The Photo is displayed in
the form or report. I have a text box on the form or report that displays
the path and file name I wish to remove every thing except the file name.
The path and file name are stored in a table

Take a look at http://www.mvps.org/access/api/api0001.htm at "The Access
Web" for a complete example about how to invoke the standard Windows File
Open dialog and retrieve the full path to the picture. Once you've got the
full path to the file, you can use the Dir function to strip off the path
information.
 

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

Back
Top