本文介绍了插入SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 可以将附加查询的SQL代码插入表单模块吗? 表单模块当前有一个DoCmd运行宏语句。 宏打开附加正确运行的查询。 我正在尝试消除表单代码中的DoCmd和引用的宏。 SQL代码: INSERT INTO tblWT1(Mfg,Series,Model,Config,Options) SELECT tblMain.Mfg,tblMain.Series,tblMain.Model,tblMain.Config,_ tblMain.Options FROM tblMain WHERE(((tblMain.Mfg)= [Forms]![Form1]。[Text1])); 插入显示的帮助文件: 语法 多记录附加查询: INSERT INTO target [IN externaldatabase] [(field1 [,field2 [,...]])] SELECT [source。] field1 [,field2 [,...] 来自tableexpression 所以 INSERT INTO tblWT1(制造商,系列,型号,配置,选项) 被修改为: INSERT INTO tblWT1 [(制造[,系列[,模型[,配置[,选项]]]]]] tblWT1突出显示,错误信息显示预期声明结束。 也可能有其他语法错误,但代码停在 目标定义。该模块包含所有表格和字段的DIM语句。 Chuck -Can the SQL code from an Append query be inserted into the form module?The form module currently has a DoCmd Run Macro statement.The Macro opens the Append query which runs correctly.I''m trying to eliminate the DoCmd in the form code and the referenced Macro.SQL code:INSERT INTO tblWT1 ( Mfg, Series, Model, Config, Options )SELECT tblMain.Mfg, tblMain.Series, tblMain.Model, tblMain.Config, _tblMain.OptionsFROM tblMainWHERE (((tblMain.Mfg)=[Forms]![Form1].[Text1]));Help file on Insert Into shows:SyntaxMultiple-record append query:INSERT INTO target [IN externaldatabase] [(field1[, field2[, ...]])]SELECT [source.]field1[, field2[, ...]FROM tableexpressionSoINSERT INTO tblWT1 ( Mfg, Series, Model, Config, Options )was modified to:INSERT INTO tblWT1 [(Mfg[, Series[, Model[, Config[, Options]]]])]tblWT1 gets highlighted and error message says Expected End of Statement.There are probably other syntax errors as well, but the code stops at thetarget definition. The module has DIM statements for all tables and fields.Chuck--推荐答案 感谢您的帮助。 我还不够一个程序员 - 但是 - 使用它 - 但是。 我将继续努力,直到我明白它在做什么。 Chuck -Thanks fot your help.I''m not enough of a programer - yet - to make use of it - yet.I''m going to keep working on it until I understand what it is doing.Chuck-- 这篇关于插入SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 17:56