Darren DICK
d.dick at uws.edu.au
Tue Dec 9 19:09:47 CST 2003
Thanks Marty Excellent DD ----- Original Message ----- From: "MartyConnelly" <martyconnelly at shaw.ca> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Wednesday, December 10, 2003 10:56 AM Subject: Re: [AccessD] CmdRunApp Help > Microsoft Scripting Runtime scrrun.dll > > Darren DICK wrote: > > >HI John > >What is the file to reference to get the FSO working? > > > >----- Original Message ----- > >From: "John W. Colby" <jcolby at colbyconsulting.com> > >To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> > >Sent: Wednesday, December 10, 2003 7:11 AM > >Subject: RE: [AccessD] CmdRunApp Help > > > > > > > > > >>why don't you just do it from within Access? If the filesystem object is > >>accessible, reference it. Then: > >> > >>Function CopyFile(strFileName As String, strDestDir As String) As Boolean > >>On Error GoTo Err_CopyFile > >>Dim fs As FileSystemObject > >> Set fs = CreateObject("Scripting.FileSystemObject") > >> 'On Error Resume Next > >> 'if the file doesn't exist, ignore the error > >> fs.CopyFile strFileName, strDestDir > >> CopyFile = True > >>Exit_CopyFile: > >>On Error Resume Next > >> Set fs = Nothing > >>Exit Function > >>Err_CopyFile: > >> MsgBox Err.Description, , "Error in Sub basUtils.CopyFile" > >> Resume Exit_CopyFile > >> Resume 0 '.FOR TROUBLESHOOTING > >>End Function > >>Sub DeleteFile(strFileName As String) > >>On Error GoTo Err_DeleteFile > >>Dim fs As FileSystemObject > >> Set fs = CreateObject("Scripting.FileSystemObject") > >> On Error Resume Next > >> 'if the file doesn't exist, ignore the error > >> fs.DeleteFile strFileName > >>Exit_DeleteFile: > >>On Error Resume Next > >> Set fs = Nothing > >>Exit Sub > >>Err_DeleteFile: > >> Select Case Err > >> Case 0 '.insert Errors you wish to ignore here > >> Resume Next > >> Case Else '.All other errors will trap > >> Beep > >> MsgBox Err.Description, , "Error in Sub basUtils.DeleteFile" > >> Resume Exit_DeleteFile > >> End Select > >> Resume 0 '.FOR TROUBLESHOOTING > >>End Sub > >>Sub RenameFile(strFileName As String, strNewName As String) > >>On Error GoTo Err_RenameFile > >> Dim fs As FileSystemObject > >> Dim f As File > >> Set fs = CreateObject("Scripting.FileSystemObject") > >> Set f = fs.GetFile(strFileName) > >> f.Name = strNewName > >>Exit_RenameFile: > >>On Error Resume Next > >> Set f = Nothing > >> Set fs = Nothing > >>Exit Sub > >>Err_RenameFile: > >> Select Case Err > >> Case 0 '.insert Errors you wish to ignore here > >> Resume Next > >> Case Else '.All other errors will trap > >> Beep > >> MsgBox Err.Description, , "Error in Sub basUtils.RenameFile" > >> Resume Exit_RenameFile > >> End Select > >> Resume 0 '.FOR TROUBLESHOOTING > >>End Sub > >>'.Comments : > >>'.Parameters: > >>'.Created by: John W. Colby > >>'.Created : 12/5/2002 9:29:43 PM > >>Sub CreateDir(strPath As String) > >>On Error GoTo Err_CreateDir > >>Dim fs As FileSystemObject > >> Set fs = CreateObject("Scripting.FileSystemObject") > >> On Error Resume Next > >> 'if the file doesn't exist, ignore the error > >> fs.CreateFolder strPath > >>Exit_CreateDir: > >>On Error Resume Next > >> Set fs = Nothing > >>Exit Sub > >>Err_CreateDir: > >> Select Case Err > >> Case 0 '.insert Errors you wish to ignore here > >> Resume Next > >> Case Else '.All other errors will trap > >> Beep > >> MsgBox Err.Description, , "Error in Sub basUtils.CreateDir" > >> Resume Exit_CreateDir > >> End Select > >> Resume 0 '.FOR TROUBLESHOOTING > >>End Sub > >> > >>John W. Colby > >>www.ColbyConsulting.com > >> > >>-----Original Message----- > >>From: accessd-bounces at databaseadvisors.com > >>[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gowey Mike W > >>Sent: Tuesday, December 09, 2003 3:03 PM > >>To: Access Developers discussion and problem solving > >>Subject: [AccessD] CmdRunApp Help > >> > >> > >> > >>Hello all, > >> > >>I have within my database a call to run a batch program that takes a > >>file that resides on one of our Network servers and copies it to our > >>local server and renames it to a text file. I than take that text file > >>and import it into a table. > >> > >>My question is, is there a way to call the batch program and have it run > >>in the background or run minimized. Right now it works but the dos > >>window comes up over the top of the database and does the copy and > >>rename in other words runs in the foreground. > >> > >>I have a progress meter that comes up that I would like the user to see > >>rather than the ugly little black dos window. > >> > >>Thanks in advance for any advice. > >> > >> > >>Mike Gowey, MCSA, A+ > >>Team Leader - SRCI > >>Information Systems & Services Division > >> > >> > >> > >>_______________________________________________ > >>AccessD mailing list > >>AccessD at databaseadvisors.com > >>http://databaseadvisors.com/mailman/listinfo/accessd > >>Website: http://www.databaseadvisors.com > >> > >> > >> > >>_______________________________________________ > >>AccessD mailing list > >>AccessD at databaseadvisors.com > >>http://databaseadvisors.com/mailman/listinfo/accessd > >>Website: http://www.databaseadvisors.com > >> > >> > >_______________________________________________ > >AccessD mailing list > >AccessD at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/accessd > >Website: http://www.databaseadvisors.com > > > > > > > > -- > Marty Connelly > Victoria, B.C. > Canada > > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com