List Info

Thread: Help with file transfer complete




Help with file transfer complete
country flaguser name
United States
2008-03-03 14:39:32

All,
Please help me. ; I have an application that is reading Excel file using OLE_DB.  The problem is I need to ensure the file
is sited in the directory before I can make a connection to it.  The files are coming from another PC and are going to a shared folder on
the system that will be establishing the connection.
 
How can I be sure the process of copying is complete?
 
"HOT ISSUE"
 
 PLEASE HELP
 

Joseph Wasko

Pannier Corporation

Software Engineer

P: 412-492-1400 X 314

F: 412-492-1418

pannier.com" href="mailto:jpwpannier.com">jpwpannier.com

www.pannier.com

 

__._,_.___
.

__,_._,___
Re: Help with file transfer complete
country flaguser name
United States
2008-03-03 20:27:36

--- In helpwithvb%40yahoogroups.com">helpwithvbyahoogroups.com, "Joe Wasko"; <jpw...> wrote:
&gt;
> All,
>; Please help me. I have an application that is reading Excel file
using
> OLE_DB. The problem is I need to ensure the file
>; is sited in the directory before I can make a connection to it.
The files
&gt; are coming from another PC and are going to a shared folder on
> the system that will be establishing the connection.
>
> How can I be sure the process of copying is complete?
>
> "HOT ISSUE";
>
> PLEASE HELP
>;
> Joseph Wasko
&gt;
> Pannier Corporation
>
> Software Engineer
>
> P: 412-492-1400 X 314
>
> F: 412-492-1418
>
> <mailto:jpw...> jpw...
>
> <http://www.pannier.com/> www.pannier.com
&gt;

Joseph:

I wrote this piece of code serveral years ago, but it should work
with minor changes:

'----------------------------------------------------------
----------
Public Function FileExists(theFile As String) As Boolean
' Date: 5/14/01
' Author: Milton Rojas
' Purpose: Checks to see if the file name passed exists. Returns
True if file exists
' Called by: EmailFiles, EmailTemplates
' Calls: LogErrors
' Last Update:5/14/01

Dim X As String
On Error GoTo ExistsError
X = Dir(theFile)
If X <> "&quot; Then
FileExists = True
Else
FileExists = False
End If
Exit Function
ExistsError:
gblnSevere = True
gblnThereWasAnError = True
FileExists = True
LogErrors ("modFileUtils.FileExists: " & Err.Description)
End Function

Milton

__._,_.___
.

__,_._,___
Re: Re: Help with file transfer complete
country flaguser name
United States
2008-03-04 16:38:50

Milton your function will tell you if the file is there but not if it is
zero bytes, so if you try and open the file for input it will error out on you.

Maybe try this

Public Function FileExists(sSource As String) As Boolean

Free = FreeFile
Open sSource For Binary As #Free
If LOF(Free) <> 0 Then
FileExists = True
Close #Free
Else
Close #Free
FileExists = False
Kill sSource
End If

End Function

At 09:27 PM 3/3/2008, you wrote:

>--- In helpwithvb%40yahoogroups.com">helpwithvbyahoogroups.com, "Joe Wasko"; <jpw...> wrote:
&gt; >
>; > All,
>; > Please help me. I have an application that is reading Excel file
>;using
&gt; > OLE_DB. The problem is I need to ensure the file
>; > is sited in the directory before I can make a connection to it.
>The files
&gt; > are coming from another PC and are going to a shared folder on
> > the system that will be establishing the connection.
> >
>; > How can I be sure the process of copying is complete?
> >
>; > "HOT ISSUE";
> >
>; > PLEASE HELP
>; >
>; > Joseph Wasko
&gt; >
>; > Pannier Corporation
> >
>; > Software Engineer
> >
>; > P: 412-492-1400 X 314
> >
>; > F: 412-492-1418
> >
>; > <mailto:jpw...> jpw...
> >
>; > <http://www.pannier.com/> www.pannier.com
&gt; >
>;
>Joseph:
>
>I wrote this piece of code serveral years ago, but it should work
>;with minor changes:
>
>;'----------------------------------------------------------
>----------
&gt;Public Function FileExists(theFile As String) As Boolean
>' Date: 5/14/01
>' Author: Milton Rojas
&gt;' Purpose: Checks to see if the file name passed exists. Returns
>True if file exists
&gt;' Called by: EmailFiles, EmailTemplates
>' Calls: LogErrors
>' Last Update:5/14/01
>;
> Dim X As String
&gt; On Error GoTo ExistsError
> X = Dir(theFile)
> If X <> "&quot; Then
>; FileExists = True
>; Else
>; FileExists = False
&gt; End If
> Exit Function
>ExistsError:
&gt; gblnSevere = True
>; gblnThereWasAnError = True
>; FileExists = True
>; LogErrors ("modFileUtils.FileExists: " & Err.Description)
&gt;End Function
>
>;Milton
&gt;
>
>
&gt;
>
>Yahoo! Groups Links
&gt;
>
>

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )