Hi All
How do I convert the below code to work using VBscript in SQL 2005.Please help urgently if you can. This code was used in Access database and sometimes it was giving Errors.
Function ImportFile()
'change the name of the constant to the report/table imported
Const conINPUTTABLE = "TSM83D"
Const conIMPORTSPECNAME = "TSM83D Import Specification"
Const conPATHTOFILE = "C:\TSM83D.txt"
On Error GoTo errImport
'delete old
DoCmd.DeleteObject acTable, conINPUTTABLE
'import new
DoCmd.TransferText acImportFixed, conIMPORTSPECNAME, conINPUTTABLE, conPATHTOFILE, False, ""
MsgBox "Finished importing file to " & conINPUTTABLE & ".", , "File Imported"
Exit Function
errImport:
'if old table not found, table does not exist therefore ignore
If Err.Number = 3011 Then
Resume Next 'carry on with the next step
Else
MsgBox Err.Number & " " & Err.Description
Exit Function
End If
End Function