使用CurrentDb.Execute的SQL语句问题 [英] Problem with SQL statement using CurrentDb.Execute

查看:1159
本文介绍了使用CurrentDb.Execute的SQL语句问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我这个SQL语句有什么问题吗?

Can anyone tell me whats wrong with this SQL statement?

展开 | 选择 | Wrap | 行号

推荐答案

你不需要在你的插入值中包含ID

you don''t need to include ID in your insert values like this

展开 | 选择 | Wrap | 行号


首先通过将SQL分配给字符串,可以使用 Debug.Print strSQL 在立即窗口中查看整个内容,看看它是如何实现的连接后聚集在一起。你不需要把Null值或日期放在字符串之外。


话虽如此,你可以试试这个,但是...

By assigning the SQL to a string first, you can use Debug.Print strSQL to view the whole thing in the Immediate Window to see how it came together after the concatenations. You don''t need to put the Null value or date outside the string.

That being said, you could try this, but...

展开 | 选择 | Wrap | 行号


Colintis已经击中了头部。您无法将值设置为自动编号字段(出于相当明显的原因)。创建此类记录时,您必须将这些字段排除在列表之外(正如他所说)。


PS。这不是对Pat的帖子的评论,因为当我发布时,这对我来说是不可见的。
Colintis has hit the nail on the head. You cannot set values into AutoNumber fields (for fairly obvious reasons). When creating such records you must leave those fields out of the list (just as he said).

PS. That wasn''t a comment on Pat''s post as that was not visible to me when I posted.


这篇关于使用CurrentDb.Execute的SQL语句问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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