表名正确时运行时错误3078

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了表名正确时运行时错误3078相关的知识,希望对你有一定的参考价值。

我已经检查了一些与此相关的文章,没有回答解决我自己的问题。

我正在尝试复制tbl_MBR_MiscSteps中有值的所有记录:

CO = Forms!frm_BP10_Tablet_MBR_Process!CO

并将其更改为:

Forms!frm_BP10_Tablet_ViewMBR!TxtSaveAs

我一直在标准表达式中找不到'|1'字段,当我尝试立即窗口时,我收到错误

3078:找不到输入表。

我还检查了?currentdb.TableDefs("tbl_MBR_MiscSteps").Name并得到了tbl_MBR_MiscSteps

有人可以告诉我我的代码丢失了吗?

Private Sub Command617_Click()
Dim sSQL As String
q2 = Chr$(34) & Chr$(34)
dq = Chr$(34) 'double quotes

sSQL = "INSERT INTO tbl_MBR_MiscSteps (CO, Step, Tank, RawMaterial, Weight, 
Amount, QuantityWeighed, QuantityDispensed, ScaleID, StartingAmount, " _
& "StartingAmountxBCoatingSolutionNeeded, ContainerTankID, 
NitrogenIsFlowing, Screen, StartTime, StopTime, CompletedByDate, 
CheckedByDate, CommentsBy) SELECT " _
& dq & Replace(Nz([TxtSaveAs]), dq, q2) & dq & "," _
& dq & Replace(Nz([Step]), dq, q2) & dq & "," _
& dq & Replace(Nz([Tank]), dq, q2) & dq & "," _
& dq & Replace(Nz([RawMaterial]), dq, q2) & dq & "," _
& dq & Replace(Nz([Weight]), dq, q2) & dq & "," _
& dq & Replace(Nz([Amount]), dq, q2) & dq & "," _
& dq & Replace(Nz([QuantityWeighed]), dq, q2) & dq & "," _
& dq & Replace(Nz([QuantityDispensed]), dq, q2) & dq & "," _
& dq & Replace(Nz([ScaleID]), dq, q2) & dq & "," _
& dq & Replace(Nz([StartingAmount]), dq, q2) & dq & "," _
& dq & Replace(Nz([StartingAmountxBCoatingSolutionNeeded]), dq, q2) & dq & "," _
& dq & Replace(Nz([ContainerTankID]), dq, q2) & dq & "," _
& dq & Replace(Nz([NitrogenIsFlowing]), dq, q2) & dq & "," _
& dq & Replace(Nz([Screen]), dq, q2) & dq & "," _
& dq & Replace(Nz([StartTime]), dq, q2) & dq & "," _
& dq & Replace(Nz([StopTime]), dq, q2) & dq & "," _
& dq & Replace(Nz([CompletedByDate]), dq, q2) & dq & "," _
& dq & Replace(Nz([CheckedByDate]), dq, q2) & dq & "," _
& dq & Replace(Nz([CommentsBy]), dq, q2) & dq & "," _
& "FROM tbl_MBR_MiscSteps " _
& "WHERE CO = Forms!frm_BP10_Tablet_MBR_Process!CO"
CurrentDb.Execute sSQL, dbFailOnError
End Sub
答案

你可以尝试这样的事情(完成未经测试):

Private Sub Command617_Click()
    Dim sSQL As String
    sSQL = sSQL & "INSERT INTO "
    sSQL = sSQL & "    tbl_MBR_MiscSteps "
    sSQL = sSQL & "    ("
    sSQL = sSQL & "        CO, Step, Tank, RawMaterial, Weight, Amount , QuantityWeighed, QuantityDispensed, "
    sSQL = sSQL & "        ScaleID, StartingAmount, StartingAmountxBCoatingSolutionNeeded, ContainerTankID, "
    sSQL = sSQL & "        NitrogenIsFlowing, Screen, StartTime, StopTime, CompletedByDate, CheckedByDate, CommentsBy"
    sSQL = sSQL & "    ) "
    sSQL = sSQL & "SELECT"
    sSQL = sSQL & "    "" & Replace(Nz([TxtSaveAs]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([Step]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([Tank]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([RawMaterial]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([Weight]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([Amount]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([QuantityWeighed]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([QuantityDispensed]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([ScaleID]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([StartingAmount]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([StartingAmountxBCoatingSolutionNeeded]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([ContainerTankID]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([NitrogenIsFlowing]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([Screen]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([StartTime]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([StopTime]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([CompletedByDate]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([CheckedByDate]), "", """") & "","
    sSQL = sSQL & "    "" & Replace(Nz([CommentsBy]), "", """") & "" "
    sSQL = sSQL & "FROM"
    sSQL = sSQL & "    tbl_MBR_MiscSteps "
    sSQL = sSQL & "WHERE"
    sSQL = sSQL & "    CO = Forms!frm_BP10_Tablet_MBR_Process!CO"
    CurrentDb.Execute sSQL, dbFailOnError
End Sub

以上是关于表名正确时运行时错误3078的主要内容,如果未能解决你的问题,请参考以下文章

添加新对象时运行时覆盖列表元素[重复]

应用程序在调试时运行时如何禁用 Firebase 崩溃报告?

为啥 Kubernetes 的容器在 runsc (gVisor) 上作为 Docker 中的运行时运行时会失败?

DirectX 11:运行简单的 DirectX 应用程序时运行时崩溃

删除行时,一个或多个必需参数没有给定值

Android即时运行gradle错误