> "Stephen sjw_ost" <Stephensjwost[ at ]discussions.microsoft.com> wrote in message
> news:FAE8F6FD-2764-423D-86F9-C30480AD58C1[ at ]microsoft.com...
> > Hello again,
> > I am using the Open/Save Dialog Box code found here;
> >
http://www.mvps.org/access/api/api0001.htm> > It works great! I have it inputting the full path&filename into a text box
> > just like I want.
> > What I am now trying to figure out is how to get just the file name, using
> > 1
> > instance of the code, and input the file name into a separate text box.
> > I thought I could split it but I've burned my eyes out looking at postings
> > and online documents to no avail.
> > Could I ask of someone to help me with getting the code to also provide me
> > with just the file name and input it into a separate text box like I have
> > the
> > code doing for the whole path&file name. I took the "TestIt" part and made
> > this to do the part that is working;
> >
> > Function GetFile1()
> > Dim strFilter As String
> > Dim lngFlags As Long
> > strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)",
> > _
> > "*.MDA;*.MDB")
> > strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
> > strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.XLS")
> > strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
> > strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
> >
> > Form_f_GetFileandLocation!LocationFile1.Value = _
> > ahtCommonFileOpenSave(InitialDir:="G:\OST\References\", _
> > Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
> > DialogTitle:="Hello! Open Me!")
> >
> > ' Since you passed in a variable for lngFlags,
> > ' the function places the output flags value in the variable.
> > Debug.Print Hex(lngFlags)
> > End Function
> >
> > The separate text box I want to input just the file name, with extention,
> > is
> > named "FileName1" within the same form as
> > "Form_f_GetFileandLocation!LocationFile1".
> >
> > Thanks in advance for any help.
> > Stephen.
> >
> > To all of you that help out with the newbies like me, "Thank You" just
> > does
> > not say enough to describe my gratitude for your help!
>
> Follow the call to ahtCommonFileOpenSave with:
>
> Dim loc As String
> loc = Nz(Form_f_GetFileandLocation!LocationFile1.Value)
> FileName1 = Mid(loc, InstrRev(loc, "\") + 1)
>
> The InstrRev function finds the last instance of '\' in the string, so we
> instruct the Mid function to return whatever follows, ie the filename only.
>
>
>