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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3078 Cannot find the input table 'imp_CS'. Make sure it exists

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I have written an import procedure and an export procedure. The Import procedure works well but the export procedure is what is giving me the error. I have tried everything but the error is telling me that the string is not being cleared. What can I do ?

Tom


Code:
Function ImportCS(strClientName As String)
    Dim strPath As String
    Dim strTbl1Name As String
    Dim strTbl2Name As String
    Dim strFileExt As String
    Dim strCurRptMon As String
    Dim strCurMon As String
    Dim intPd As Integer
    Dim strCurMonL As String
    Dim strCurMonS As String
    Dim intCurFiscalMon As Integer
    Dim intCurFiscalYr As Integer
    Dim intFiscalMon As Integer
    Dim intCurCalYr As Integer
    Dim intCurRptMon As Integer
    Dim intCurRptYr As Integer
    Dim dtCurDate As Date
    Dim strSpecName As String
    Dim strTbl1Namewoext As String
    Dim strDelete As String
    Dim intX As Integer
    Dim intTblNme As Integer
    Dim strSQL As String
    Dim rst As Recordset
    
    strPath = "S:\"
    strFileExt = ".txt"
    DoCmd.SetWarnings False
    strSpecName = "IMP_CS_SPEC"
 '    PROCEDURE TO GET DATA
    
strSQL = " SELECT rptpd,rptpddiff,csfile" & _
" FROM dbo_rpt_FYInfo" & _
" WHERE rptpddiff = 1 AND uci ='SSH';"

Debug.Print strSQL
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rst.EOF Then
    With rst
        .MoveLast
        .MoveFirst
    End With
    strCSFile = (rst![csfile])
    strRptPd = (rst![rptpd])
   
End If
rst.Close
Set rst = Nothing
    
    strTbl1Namewoext = "impCS"
    DoCmd.TransferText TransferType:=acImportDelim, _
                       SpecificationName:=strSpecName, _
                       TableName:=strTbl1Namewoext, _
                       FileName:=strPath & strCSFile, _
                       HasFieldNames:=True
    MsgBox strTbl1Namewoext & " has been imported"
    DoCmd.SetWarnings True
End Function

'Export Procedure
Public Function Export(strUCI As String)
Dim strSpecName As String
Dim strPath As String
Dim strCSFile As String
Dim strExportFile As String
Dim strMonNm As String
Dim strCY As String
Dim strTable As String
Dim strSQL As String
Dim rst As Recordset

    strPath = ""
    strFileExt = ""
    strTable = ""
    strSpecName = ""
    strPath = "W:\_RptSets\OTHER\" & strUCI & "\"
    strFileExt = ".txt"
    strTable = "SSH_ChargeExtract_"
    DoCmd.SetWarnings False
    strSpecName = "EXP_ChgExtract"
'    PROCEDURE TO GET DATA
    
strSQL = " SELECT uci,mon_nm,cy,rptpddiff" & _
" FROM dbo_rpt_FYInfo" & _
" WHERE rptpddiff = 1 AND uci ='SSH';"

Debug.Print strSQL
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rst.EOF Then
    With rst
        .MoveLast
        .MoveFirst
    End With
    strMonNm = (rst![mon_nm])
    strCY = (rst![cy])
    
    'strReturnString = (rst![cal_num]) & (rst![yr])
End If
rst.Close
Set rst = Nothing
strExportFile = "SSH_ChargeExtract_" & strMonNm & strCY & strFileExt
DoCmd.TransferText TransferType:=acExportDelim, _
                       SpecificationName:=strSpecName, _
                       TableName:=strTable, _
                       FileName:=strPath & strExportFile, _
                       HasFieldNames:=True
    MsgBox strExportFile & " has been exported"
    DoCmd.SetWarnings True
End Function
 
You want to export a table named "SSH_ChargeExtract_" (value of strTable) ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I figuered out what was causing the issue. I did a manual export and found I got an error when time came to use the query the export was based on. I renamed the query with no underscores in it and the export worked great.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top