
Originally Posted by
RuralGuy
Your issue may be Win7 rather than ac2007. Care to post a sample of your db so I can try it? I have the same setup.
Here is what my code looks like now withthe different things I tryed.
Code:
Private Sub cmdProcess_Click()
Dim fs As Variant
Dim a As String
Dim b As String
Dim RetVal
Dim strCmd As String
On Error GoTo ErrorHandler:
DoCmd.RunSQL "Delete * from Hld"
If MsgBox("Is this the location and name of the folder you want ?" & vbCrLf & "S:\Accounting\AP\1099 ITEMS\W9 Folder\Corrected 2011 W9\", vbYesNo + vbInformation, "Cutoff Date Check") = vbYes Then
Call Shell("S:\Accounting\AP\1099 ITEMS\W9 Folder\Corrected 2011 W9\File List Generator.bat", vbNormalFocus)
'Call Shell(Environ$("COMSPEC") & " /k S:\Accounting\AP\1099 ITEMS\W9 Folder\Corrected 2011 W9\File List Generator.bat", vbNormalFocus)
'Shell "cmd /k" & "S:\Accounting\AP\1099 ITEMS\W9 Folder\Corrected 2011 W9\File List Generator.bat", vbNormalFocus
DoEvents
'Runs the application and creates the list of files names
Else
a = BrowseFolder("Please select the folder you want to generate a list from") 'Gets the file path from the user
a = a & "\"
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfile "S:\Accounting\DB\development\File List Generator.bat", a
Set fs = Nothing
a = a & "File List Generator.bat"
Call Shell(a, 1) 'Runs the application and creates the list of files names
'Note: this list will be brought into the database and it has a .pdf extension and a header which will have to be addressed.
End If
b = "S:\Accounting\DB\development\hld.txt"
DoCmd.TransferText acImportDelim, "Hld Import Specification", "Hld", b
Exit Sub
ErrorHandler:
''' If we ran into any errors this will explain what they are.
MsgBox Err.Description, vbCritical, "Shell Error"
End Sub
I also tryed it on an XP machine and got the same thing.