- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这段代码写于2017年并一直有效-突然间它给了我一个语法错误...我似乎看不到这个问题。抱歉,我意识到它的很多代码...我们每月导入的一个冗长的发票文件-找到正确的季度来添加临时表。
db.Execute "INSERT INTO" & varQuarter & " ([Ship Date], [Invoice Date], [Sell Price per Unit],
[Differential Amount]," _
& " [Net Product Amount], [Amount Due], [Product Sell Amount Due], [Discount Amount Due],
[Miscellaneous Amount Due]," _
& " [Storage Amount Due], [Overage Storage Amount Due], [Freight Amount Due], [Tax Amount Due],
[Memo Sell Amount]," _
& " [Memo Tax Amount], [Billing Unit Quantity], [Billing Unit Count], [Billing Unit Code], [Shipped
Quantity]," _
& " [Invoiced Quantity], [Invoice Source System], [Invoice Number], [Invoice Bill Code], [Order
Number], [Form Number]," _
& " [Form Name], [PO Number], [Requisition Number], [Billing Cost Center Number], [Using Cost Center
Number]," _
& " [Warehouse Number], [Bill Of Lading Number], [Bill Of Lading Item Number], [Ship Mark For Text],
[CCN Customer Name]," _
& " [CCN Customer Number], [Bill to Customer Name], [Bill to Customer Number], [Ship To Customer
Number]," _
& " [Ship To Customer Name], [Ship To Address Line1], [Ship To Address Line2], [Ship To City],
[Ship To State]," _
& " [Ship To Zip Code], [Plant Code], [Plant Name], [Product Code], [Product Name], [Postage Amount
Due]," _
& " [Freight Carrier Code], [Category Title])" _
& " SELECT [Ship Date], [Invoice Date], [Sell Price per Unit], [Differential Amount], [Net Product
Amount], [Amount Due]," _
& " [Product Sell Amount Due], [Discount Amount Due], [Miscellaneous Amount Due], [Storage Amount
Due]," _
& " [Overage Storage Amount Due], [Freight Amount Due], [Tax Amount Due], [Memo Sell Amount], [Memo
Tax Amount]," _
& " [Billing Unit Quantity], [Billing Unit Count], [Billing Unit Code], [Shipped Quantity], [Invoiced
Quantity]," _
& " [Invoice Source System], [Invoice Number], [Invoice Bill Code], [Order Number], [Form Number],
[Form Name], [PO Number]," _
& " [Requisition Number], [Billing Cost Center Number], [Using Cost Center Number], [Warehouse
Number], [Bill Of Lading Number]," _
& " [Bill Of Lading Item Number], [Ship Mark For Text], [CCN Customer Name], [CCN Customer Number],
[Bill to Customer Name]," _
& " [Bill to Customer Number], [Ship To Customer Number], [Ship To Customer Name], [Ship To Address
Line1]," _
& " [Ship To Address Line2], [Ship To City], [Ship To State], [Ship To Zip Code], [Plant Code],
[Plant Name], [Product Code]," _
& " [Product Name], [Freight Carrier Code], [Postage Amount Due], [Category Title]" _
& " FROM tblInvoicesTemp;"
最佳答案
只需避免需要长时间连接,换行和引号的VBA字符串查询。具体来说,您的问题似乎是INSERT INTO" & VarQuarter & "
,如果空间不是问题(例如,错字后的StackOverflow),则可能是VarQuarter
的实际值。如果表名保留空格(如您的所有列),特殊字符或前导数字,则必须使用方括号或反引号将其转义。
但是,通过保存Access存储的查询(最好是单个最终发票表)来完全避免这种长字符串构建。这样做,您不必担心换行或串联。此外,查询设计器不会将SQL与语法问题一起保存,并且Access引擎会为存储的查询缓存统计信息以实现最佳执行计划(因此,为什么它们比在VBA中动态运行的已解析SQL更好)。如果需要在WHERE
子句中传递VBA值,则仍可以使用带有参数支持的已保存查询。
SQL (另存为Access存储的查询,或者每个四分之一表一个)
INSERT INTO [myFinalTable] ([Ship Date], [Invoice Date], [Sell Price per Unit],
[Differential Amount], [Net Product Amount], [Amount Due],
[Product Sell Amount Due], [Discount Amount Due],
[Miscellaneous Amount Due], [Storage Amount Due],
[Overage Storage Amount Due], [Freight Amount Due],
[Tax Amount Due], [Memo Sell Amount], [Memo Tax Amount],
[Billing Unit Quantity], [Billing Unit Count], [Billing Unit Code],
[Shipped Quantity], [Invoiced Quantity], [Invoice Source System],
[Invoice Number], [Invoice Bill Code], [Order Number], [Form Number],
[Form Name], [PO Number], [Requisition Number], [Billing Cost Center Number],
[Using Cost Center Number], [Warehouse Number], [Bill Of Lading Number],
[Bill Of Lading Item Number], [Ship Mark For Text], [CCN Customer Name],
[CCN Customer Number], [Bill to Customer Name], [Bill to Customer Number],
[Ship To Customer Number], [Ship To Customer Name], [Ship To Address Line1],
[Ship To Address Line2], [Ship To City], [Ship To State],
[Ship To Zip Code], [Plant Code], [Plant Name], [Product Code], [Product Name],
[Postage Amount Due], [Freight Carrier Code], [Category Title])
SELECT [Ship Date], [Invoice Date], [Sell Price per Unit], [Differential Amount]
, [Net Product Amount], [Amount Due], [Product Sell Amount Due], [Discount Amount Due]
, [Miscellaneous Amount Due], [Storage Amount Due], [Overage Storage Amount Due]
, [Freight Amount Due], [Tax Amount Due], [Memo Sell Amount], [Memo Tax Amount]
, [Billing Unit Quantity], [Billing Unit Count], [Billing Unit Code], [Shipped Quantity]
, [Invoiced Quantity], [Invoice Source System], [Invoice Number], [Invoice Bill Code]
, [Order Number], [Form Number], [Form Name], [PO Number], [Requisition Number]
, [Billing Cost Center Number], [Using Cost Center Number], [Warehouse Number]
, [Bill Of Lading Number], [Bill Of Lading Item Number], [Ship Mark For Text]
, [CCN Customer Name], [CCN Customer Number], [Bill to Customer Name]
, [Bill to Customer Number], [Ship To Customer Number], [Ship To Customer Name]
, [Ship To Address Line1], [Ship To Address Line2], [Ship To City]
, [Ship To State], [Ship To Zip Code], [Plant Code], [Plant Name], [Product Code]
, [Product Name], [Freight Carrier Code], [Postage Amount Due], [Category Title]
FROM tblInvoicesTemp;
VBA
DoCmd.OpenQuery "myAppendQuery" ' NO NEED TO CLOSE ACTION QUERIES
现在,如果您使用许多四分之一表,则为每个表保存一个相应的查询,并在
OpenQuery
调用中动态分配查询名称并传递变量值:
Dim VarQuarter
VarQuarter = ...
DoCmd.OpenQuery VarQuarter ' NO NEED TO CLOSE ACTION QUERIES
为了避免用户更新/插入警告,请使用较早的
Database.Execute
方法:
Dim VarQuarter
VarQuarter = ...
db.Execute VarQuarter
关于vba - 错误3134-语法错误-可以运行数年,但现在不会。找不到错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65603831/
我似乎无法让它发挥作用。我已经尝试过在线样本,但没有一个正是我需要的。基本上我希望能够显示从给定日期过去的天数。我下面的示例是 HTML 和 PHP 的组合,出于某些原因我不得不这样做。 Date
Closed. This question needs to be more focused。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅关注editing this post的一个问题。
在此处搜索“线程关联”的答案,我发现人们对此很感兴趣,但没有什么理由可以节省可能获得稳定的 QueryPerformanceTimer 结果。 假设一个现代操作系统和一个现代 2-4 插槽工作站/服务
我有一个称为main-app的聚合物元素:
我有一个表,我想在每个插入时间记录每个订单的时间戳。但是,我得到的时间戳值为零。 这是我的架构: CREATE TABLE IF NOT EXISTS orders( orde
我正在使用 MongoDB Atlas 来托管数据库并使用这个无服务器函数查询数据: import { NextApiRequest, NextApiResponse } from "next"; /
苹果卸下了转义键,并用OLED触摸条替换了它。这对emacs用户具有影响,特别是对于具有数十年肌肉内存力才能克服此变化的UNIX/emacs用户而言。幸运的是,触摸栏逃生键似乎总是在您需要的时候出现,
抱歉,我对 DbGrids 还很陌生。 我是否应该使用查询的字段编辑器并以某种方式添加一个捕获 TIMEDIFF 的新字段,然后将其添加为我的 DbGrid 中的列? 或者我可以/应该跳过字段编辑器并
正如一本相当古老的书XUnit Patterns所写,NUnit 2.0不会为每个测试创建新的测试夹具,因此,如果测试正在操纵夹具的某种状态,则该夹具会被共享并且可能导致各种不良副作用。 还是一样吗?
我知道自2016年4月以来,Youtube API的默认配额限制为1M。 如果要增加它,我们需要向Google 发送请求。 我想知道我们可以要求的配额限制的最大值是多少? 最佳答案 根据Google开
这个问题不太可能对任何 future 的访客有帮助;它只与一个较小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于全世界的互联网受众。如需帮助使此问题更广泛适用,visit the
{ "size": 0, "query": { "range": { "LogTime": { "gte": "now-1d",
当我尝试从终端编译这个简单的代码时: #include int main(void) { printf("%f\n",sqrt(10)); return 0; } 使用 gcc mai
我正在尝试筛选抓取一个 html 页面,以便我可以从中提取所需的有值(value)的数据并将其放入文本文件中。到目前为止,一切进展顺利,直到我在 html 页面中遇到了这个: In inventor
这是我的 结果 MySQL 表的示例: 我想将特定用户的所有日期向前移动相同的时间间隔,以便该用户的最高日期是当前时间戳。我知道如何获取以天为单位的间隔: /* result is 823 */ SE
我有一个函数需要从主视图中的几个不同位置调用。我们称它为 updateFunction。 我这样声明: - (void)updateFunction { //updates some vari
我正在尝试找出如何以某种方式嵌套回调。 var alpha = function(callback){ var x = 5; if(x > 2){ callback()
为什么我收到RangeError:超出最大调用堆栈错误?我正在尝试解析文本以找到数学并解决它。它一直有效,直到我开始实现括号'。我试图找出错误,但就是无法弄清楚。 我的代码: var alg = {
我记得几年前,没有使用 SSL 的原因之一是它占用了大量资源,因此影响了应用程序的性能。 如今,以当前的技术,这仍然是一个需要牢记的点吗? 这个问题的出现是因为一位同事担心使用 SSL 会影响他的应用
我正在将我的数据库从 sqlserver 迁移到 mysql当我在 sqlserver 中使用 getDate() 函数时,mysql 中的替换是 Now()但是 Now() 没有返回 getDate
我是一名优秀的程序员,十分优秀!