Group:  Microsoft Access ยป microsoft.public.access.modulesdaovba
Thread: Save a File from a Text Box

Geek News

Save a File from a Text Box
Stephen sjw_ost 12/30/2008 10:42:12 PM
I have a Text Box on a Form that contains the full filepath and filename of
the users choice. How can programically I use the filepath & filename, from
the Text Box, to save the indicated file to a shared drive (Z:\) or shared
point (HTTP://Intranet)?

Thank you for any help.
Stephen
Re: Save a File from a Text Box
"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> 12/31/2008 9:58:05 AM
Hi,
I think you can just copy it, try to use FileCopy statement.

For HTTP://Intranet it is more tricky, you have to use API functions to
upload file for HTTP or FTP, much easier if you can also use UNC path and
copy file

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Stephen sjw_ost" <Stephensjwost[ at ]discussions.microsoft.com> wrote in message
news:AAAA2503-30EC-4639-8F40-623A72DE58E1[ at ]microsoft.com...
[Quoted Text]
> I have a Text Box on a Form that contains the full filepath and filename
> of
> the users choice. How can programically I use the filepath & filename,
> from
> the Text Box, to save the indicated file to a shared drive (Z:\) or shared
> point (HTTP://Intranet)?
>
> Thank you for any help.
> Stephen

Re: Save a File from a Text Box
Stephen sjw_ost 12/31/2008 2:35:01 PM
Alex, Thank you for your response.
Do you have any examples I can look at? I keep getting errors. I tred to use
the FileCopy for saving to a drive "H:\" but it did not work.

Function Upload()
Dim myPath As String
Dim mySharePoint As String
myPath = Form_f_GetFileandLocation.LocationFile1.Value
mySharePoint = "H:\"
FileCopy myPath, mySharePoint
End Function

The above code gives me
Run-time error '52':
Bad file name or number

I also would definately need an API example to FileCopy/SaveAs to a URL
"http://Intranet" using the path&filename found in
"Form_f_GetFileandLocation.LocationFile1.Value".

Thank you
Stephen

"Alex Dybenko" wrote:

[Quoted Text]
> Hi,
> I think you can just copy it, try to use FileCopy statement.
>
> For HTTP://Intranet it is more tricky, you have to use API functions to
> upload file for HTTP or FTP, much easier if you can also use UNC path and
> copy file
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
> "Stephen sjw_ost" <Stephensjwost[ at ]discussions.microsoft.com> wrote in message
> news:AAAA2503-30EC-4639-8F40-623A72DE58E1[ at ]microsoft.com...
> > I have a Text Box on a Form that contains the full filepath and filename
> > of
> > the users choice. How can programically I use the filepath & filename,
> > from
> > the Text Box, to save the indicated file to a shared drive (Z:\) or shared
> > point (HTTP://Intranet)?
> >
> > Thank you for any help.
> > Stephen
>
Re: Save a File from a Text Box
Dymondjack 12/31/2008 4:29:01 PM
Stephen,

Have you verified that the myPath is the full path of the file
("C:\mydir\myfile.txt") and that the mySharePoint location exists?
Fortunately, error 52 (as far as I know) can only be caused by those two
things.

If you would like, I've got functions for both verifying an existing drive
and existing file. I make a habit to explicitly verify both the source and
destination before making any copies.

Maybe you've already got them... let me know if you would like the functions
though.

The file may also be locked by another process, I'm not sure if that raises
a different error or not though.

HTH
-jack

"Stephen sjw_ost" wrote:

[Quoted Text]
> Alex, Thank you for your response.
> Do you have any examples I can look at? I keep getting errors. I tred to use
> the FileCopy for saving to a drive "H:\" but it did not work.
>
> Function Upload()
> Dim myPath As String
> Dim mySharePoint As String
> myPath = Form_f_GetFileandLocation.LocationFile1.Value
> mySharePoint = "H:\"
> FileCopy myPath, mySharePoint
> End Function
>
> The above code gives me
> Run-time error '52':
> Bad file name or number
>
> I also would definately need an API example to FileCopy/SaveAs to a URL
> "http://Intranet" using the path&filename found in
> "Form_f_GetFileandLocation.LocationFile1.Value".
>
> Thank you
> Stephen
>
> "Alex Dybenko" wrote:
>
> > Hi,
> > I think you can just copy it, try to use FileCopy statement.
> >
> > For HTTP://Intranet it is more tricky, you have to use API functions to
> > upload file for HTTP or FTP, much easier if you can also use UNC path and
> > copy file
> >
> > --
> > Best regards,
> > ___________
> > Alex Dybenko (MVP)
> > http://accessblog.net
> > http://www.PointLtd.com
> >
> > "Stephen sjw_ost" <Stephensjwost[ at ]discussions.microsoft.com> wrote in message
> > news:AAAA2503-30EC-4639-8F40-623A72DE58E1[ at ]microsoft.com...
> > > I have a Text Box on a Form that contains the full filepath and filename
> > > of
> > > the users choice. How can programically I use the filepath & filename,
> > > from
> > > the Text Box, to save the indicated file to a shared drive (Z:\) or shared
> > > point (HTTP://Intranet)?
> > >
> > > Thank you for any help.
> > > Stephen
> >

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net