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

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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
 
Assuming the text box is named txtFile, it would be something like:

Me.txtFile = strInputFileName
 
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
 
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
 
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
 
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.
 
Back
Top