Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BATCH FILECOPY INCONSISTENCIES - ACCESS LOCKUP (TIMING)?

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
US
A little difficult to follow here. I am reading a path and filename from a database field. I with to copy that as the source to a constant destination folder. I am using filecopy. The routine works, though it does not always complete the filecopy. In an example where there are 558 files to be copied, one time it did 48, another 120, etc. until Access locked up and when I exited the program got a "Access is not reponding error." There is a need at times to overwrite a file that perhaps already exists, but filecopy should simply do this according to my understanding. If this were a problem, it wouldn't explain why the program advances to different recordcounts prior to locking up. Is there another issue here with timing or something? Do I need to pause the program when performing filecopy for perhaps larger files, and where should I perform the pause. Or, do you forsee another cause to the problem?


If Me.cboSubAssy.Value <> &quot;<ALL>&quot; Then
sql_rsel = &quot;SELECT tblPartsListing.PartLocation, tblPartsListing.PartNo FROM tblPartsListing INNER JOIN tblBOM ON tblPartsListing.PartNo=tblBOM.PartNo &quot; & _
&quot;WHERE (((tblBOM.JobNo) = &quot; & Me.cboJobNo.Value & &quot;) &quot; & _
&quot;AND ((tblBOM.SubAssy) = '&quot; & Me.cboSubAssy.Value & &quot;') &quot; & _
&quot;AND ((tblPartsListing.ManufacturedBy) = 'METRO MACHINE' )) &quot;
Else
sql_rsel = &quot;SELECT tblPartsListing.PartLocation, tblPartsListing.PartNo FROM tblPartsListing INNER JOIN tblBOM ON tblPartsListing.PartNo=tblBOM.PartNo &quot; & _
&quot;WHERE (((tblBOM.JobNo) = &quot; & Me.cboJobNo.Value & &quot;) &quot; & _
&quot;AND ((tblPartsListing.ManufacturedBy) = 'METRO MACHINE' )) &quot;
End If
Set rs_rsel = CurrentDb.OpenRecordset(sql_rsel)
rs_rsel.MoveLast
y = rs_rsel.RecordCount
With rs_rsel
.MoveFirst
For z = 0 To y - 1
lblCounterStatus.ForeColor = 32768
lblCounterStatus.Caption = &quot;Copying &quot; & z + 1 & &quot; of &quot; & y
FileLocation2 = rs_rsel(&quot;PartLocation&quot;)
pn = rs_rsel(&quot;PartNo&quot;)
Debug.Print FileLocation2
Debug.Print pn
If FileLocation2 = &quot;*** FILE NOT FOUND ***&quot; Then
sa = &quot;ALL&quot;
Open &quot;i:\newmanual\_&quot; & Str(Me.cboJobNo.Value) & &quot;_&quot; & sa & &quot;_files_not_found.txt&quot; For Append As #1
Print #1, pn
Close #1
Else
CopyFile FileLocation2, pn
End If
.MoveNext
Next z
End With
End Function


Private Sub CopyFile(ByVal filename As String, ByVal file As String)
If Trim(filename) <> &quot;&quot; Then
'Set objCadApp = GetObject(filename)
Debug.Print filename
FileCopy filename, &quot;i:\newmanual\&quot; + file + &quot;.dwg&quot;
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top