How do I put the name of the browsed file into a text box? (XPost)

D

Douglas J. Steele

How are you calling the function?

If you look at the top of the page you've cited, there's sample code along
the lines of:

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

strInputFileName contains the name of the file.
 
P

PaulFort

I put that code into the 'on click' event of a button on the form. I figured
the "strInputFileName" contained the name of the file...but how do I put that
into the text box on the form? (I know it's something real basic I am asking.
Just can't find the answer by searching the help files using my keywords)
Thanks
 
P

PaulFort

Anyone know the answer to this (below)?
-I need to put the 'strInputFileName' into a text box...in the usual manner,
ie; the user browses for the file and then double clicks on it and that
file's name appears in the text box.
Thanks
 
D

Douglas J. Steele

Assuming the text box is named txtFile, it would be something like:

Me.txtFile = strInputFileName
 
A

Alvin

I am using the following code and I get the full file path. I need just the
file name.
Example: MyPic.jpg
Here is the code I have.Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "(*.jpg*.JPG*.JPEG)", "*.jpg")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
Me![FileName] = strInputFileName
Me![ImageFrame].Picture = Me![FilePath]
<

Thanks in advance, You guys are great.
Alvin
 
R

RuralGuy

Alvin:

If I understand the problem correctly I believe what you need is:

Me.txtBox = Right(strInputFileName, Len(strInputFileName) -
InStrRev(strInputFileName, "\"))

Watch the line wrap!

This yields all the characters after the last "\" in strInputFileName


RuralGuy

----------------
Alvin said:
I am using the following code and I get the full file path. I need
just the file name.
Example: MyPic.jpg
Here is the code I have.Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "(*.jpg*.JPG*.JPEG)", "*.jpg")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
Me![FileName] = strInputFileName
Me![ImageFrame].Picture = Me![FilePath]
<

Thanks in advance, You guys are great.
Alvin

Douglas J. Steele said:
Assuming the text box is named txtFile, it would be something like:

Me.txtFile = strInputFileName
 
A

Alvin

That was exactly what I wanted.
Thanks so much RuralGuy.
Alvin

RuralGuy said:
Alvin:

If I understand the problem correctly I believe what you need is:

Me.txtBox = Right(strInputFileName, Len(strInputFileName) -
InStrRev(strInputFileName, "\"))

Watch the line wrap!

This yields all the characters after the last "\" in strInputFileName


RuralGuy

----------------
Alvin said:
I am using the following code and I get the full file path. I need
just the file name.
Example: MyPic.jpg
Here is the code I have.Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "(*.jpg*.JPG*.JPEG)", "*.jpg")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
Me![FileName] = strInputFileName
Me![ImageFrame].Picture = Me![FilePath]
<

Thanks in advance, You guys are great.
Alvin

Douglas J. Steele said:
Assuming the text box is named txtFile, it would be something like:

Me.txtFile = strInputFileName

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)




Anyone know the answer to this (below)?
-I need to put the 'strInputFileName' into a text box...in the
usual manner,
ie; the user browses for the file and then double clicks on it and
that file's name appears in the text box.
Thanks

:



I put that code into the 'on click' event of a button on the form.
I figured
the "strInputFileName" contained the name of the file...but how do
I put that
into the text box on the form? (I know it's something real basic I
am asking.
Just can't find the answer by searching the help files using my
keywords) Thanks
 
C

Chris

Me.txtFile = strInputFileName<<
Where exactly do I need to enter this?

I have this on my onclick

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

My table field that I need the path to be entered too is called txtImageName

Thanks
Chris.
 

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