Access中的SQL:INSERT INTO不起作用 [英] SQL in Access: INSERT INTO not working

查看:125
本文介绍了Access中的SQL:INSERT INTO不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能做错了,因为我对SQL很缺乏经验,但我正在尝试将值插入另一个表中,其他3个列值相等。

I''m probably doing something wrong, since I''m pretty inexperienced with SQL, but I''m trying to insert values into one table from another, where 3 other column values are equivalent.

展开 | 选择 | Wrap | 行号

推荐答案

在字符串vInsertLOI后面的行上,请插入

(在你的 1.CurrentDb.Execute 之前的某个地方)
Debug.Print" rslvd_vInsertLOI ==" &安培; vInsertLOI


您可以直接通过代码,也可以直接尝试运行代码。

按< ctrl>< g>在运行/踩代码后看到字符串

你应该有类似的东西:

rslvd_vInsertLOI == INSERT INTO TBL_DocReview_byStudy([LOI日期] )SELECT [DATE SIGNED](...)


仔细检查字符串是否正确解析。


另一个提示是首先构建基本的选择查询,确保它返回所需的记录。之后将查询转换为操作查询通常很简单,然后在代码中使用查询构建器中的SQL。


此外,您应该养成设置当前数据库的对象,以确保您实际引用正确的对象并帮助处理内存开销...:
On the line following your string vInsertLOI, please insert
(somewhere right before your 1.CurrentDb.Execute )
Debug.Print "rslvd_vInsertLOI==" & vInsertLOI

You can either step thru the code, or simply attempt to run it at this point.
Press <ctrl><g> after running/stepping the code to see the string
You should have something like:

rslvd_vInsertLOI==INSERT INTO TBL_DocReview_byStudy([Date of LOI]) SELECT [DATE SIGNED] (...)

Double check that the string is resolving correctly.

Another hint is to build the basic select query first, make sure that it is returning the desired records. It''s usually simple to convert the query to an action query afterwards and then use the SQL from the query builder in the code.

Also you should get into the habit of setting an object for the current database to ensure that you are actually referring to the correct object and to help with memory overhead...:
展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


返回:

Returns:

展开 | 选择 | Wrap | 行号


将其更改为选择并在查询中运行它以查看它是否实际返回行。
Change it into a select and run it in a query to see if it actually returns rows.


这篇关于Access中的SQL:INSERT INTO不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆