更新SQL语句 [英] Update SQL Statement

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

问题描述

任何人都可以帮忙解决这个问题吗?我收到语法错误消息.....不是

擅长这个。

谢谢


DoCmd.RunSQL 更新JOTable _

& INNER JOIN [出勤跟进] ON JOTable.JOID = [出勤跟进]。

JOID" _

& Set [Attendance Follow Up] .ActEndDate =" jotable.ActEndDate"" _

& WHERE((([出勤跟进] .JOID)= [表格]![客户信息]!

[IJ / JOInformation] .form。[joid]));"


-

通过 http: //www.accessmonster.com

Can anyone help with this statement? I get a syntax error message.....not
good at this at all.
Thanks

DoCmd.RunSQL "Update JOTable" _
& "INNER JOIN [Attendance Follow Up] ON JOTable.JOID = [Attendance Follow Up].
JOID " _
& "Set [Attendance Follow Up].ActEndDate = "jotable.ActEndDate "" _
& "WHERE ((([Attendance Follow Up].JOID)=[forms]![clientinformation]!
[IJ/JOInformation].form.[joid]));"

--
Message posted via http://www.accessmonster.com

推荐答案

rebecky来自AccessMonster.com写道:
rebecky via AccessMonster.com wrote:

任何人都可以帮忙解决这个问题吗?我收到语法错误消息.....不是

擅长这个。

谢谢


DoCmd.RunSQL 更新JOTable _

& INNER JOIN [出勤跟进] ON JOTable.JOID = [出勤跟进]。

JOID" _

& Set [Attendance Follow Up] .ActEndDate =" jotable.ActEndDate"" _

& WHERE((([出勤跟进] .JOID)= [表格]![客户信息]!

[IJ / JOInformation] .form。[joid]));"
Can anyone help with this statement? I get a syntax error message.....not
good at this at all.
Thanks

DoCmd.RunSQL "Update JOTable" _
& "INNER JOIN [Attendance Follow Up] ON JOTable.JOID = [Attendance Follow Up].
JOID " _
& "Set [Attendance Follow Up].ActEndDate = "jotable.ActEndDate "" _
& "WHERE ((([Attendance Follow Up].JOID)=[forms]![clientinformation]!
[IJ/JOInformation].form.[joid]));"



有时候我们可能会这样做。

将strim作为字符串调整

strSQL ="更新JOTable ......

Docmd.RunSQL strSQL


如果它爆炸或无法正常工作,我们可能会添加

Debug。在运行查询之前打印strSQL

。然后我们可以打开Debug'的Immediate

窗口并查看strSQL的值。然后我们将它复制到剪贴板

,然后创建一个新的查询(Query / New / Design / Close / View / SQL)并在SQL窗口中粘贴

然后运行它。访问将尽力使用
来识别错误的位置。


我注意到的是你有行

更新JOTable _

& INNER JOIN

这将转化为更新JOTableINNER JOIN ......桌子和内部之间没有空间




此外,如果您使用日期字段,您可能会执行类似

DateField =#" &安培; Me.DateField& #"


我认为此时最好的办法是尝试Debug.Print。


最后一件事。 ..我会尝试避免在我的领域中使用空格

名称...除非你喜欢在所有东西周围输入[]。我宁愿

使用/进入AttendanceFollowUp而不是[出勤跟进]。为什么要为你的生活添加

问题?

Sometimes we might do something like this.
Dim strSQL as String
strSQL = "Update JOTable..."
Docmd.RunSQL strSQL

If it blows up or doesn''t work right we might add
Debug.Print strSQL
prior to running the query. We can then open up the Debug''s Immediate
Window and see the value of strSQL. We then copy it to the clipboard
and then create a new query (Query/New/Design/Close/View/SQL) and paste
it in the SQL window and then run it. Access will do its best to
identify where the error is.

What I did notice is that you have the lines
"Update JOTable" _
& "INNER JOIN
That would translate to Update JOTableINNER JOIN... There''s no space
between Table and Inner.

Also, if you are using date fields you might do something like
DateField = #" & Me.DateField & "#"

I think the best thing to do at this point is try a Debug.Print.

One last thing...I would attempt to avoid spaces in my field
names...unless you like typing [] around everything. I would prefer
using/entering AttendanceFollowUp than [Attendance Follow Up]. Why add
problems to your life?


9月11日,4:30 * pm,rebecky via AccessMonster.com < u40765 @ uwe>

写道:
On Sep 11, 4:30*pm, "rebecky via AccessMonster.com" <u40765@uwe>
wrote:

任何人都可以帮忙这个陈述吗? *我收到语法错误消息.....不是

擅长这个。

谢谢


DoCmd。 RunSQL更新JOTable _

& INNER JOIN [出勤跟进] ON JOTable.JOID = [出勤跟进]。

JOID" _

& Set [Attendance Follow Up] .ActEndDate =" jotable.ActEndDate"" _

& WHERE((([出勤跟进] .JOID)= [表格]![客户信息]!

[IJ / JOInformation] .form。[joid]));"


-

消息发布于:http://www.accessmonster.com
Can anyone help with this statement? *I get a syntax error message.....not
good at this at all.
Thanks

DoCmd.RunSQL "Update JOTable" _
& "INNER JOIN [Attendance Follow Up] ON JOTable.JOID = [Attendance Follow Up].
JOID " _
& "Set [Attendance Follow Up].ActEndDate = "jotable.ActEndDate "" _
& "WHERE ((([Attendance Follow Up].JOID)=[forms]![clientinformation]!
[IJ/JOInformation].form.[joid]));"

--
Message posted viahttp://www.accessmonster.com



它看起来像你可能已经在Query Designer界面中测试了这个并且

保存了SQL。好主意,但有一些细节需要更改。


尝试在Update JOTable和INNER JOIN之间添加一个空格,并删除

jotable.ActEndDate周围的内部引号。这会让你更接近




祝你好运。

It looks like you may have tested this in Query Designer interface and
saved the SQL. Good idea, but there are a few details that need to be
changed.

Try adding a space between Update JOTable and INNER JOIN, and remove
the inner quotes around jotable.ActEndDate. That will get you closer
at least.

Good luck.


通过AccessMonster rebecky。 com写道:
rebecky via AccessMonster.com wrote:

任何人都可以帮忙这个声明吗?我收到语法错误消息.....不是

擅长这个。

谢谢


DoCmd.RunSQL 更新JOTable _

& INNER JOIN [出勤跟进] ON JOTable.JOID = [出勤跟进]。

JOID" _

& Set [Attendance Follow Up] .ActEndDate =" jotable.ActEndDate"" _

& WHERE((([出勤跟进] .JOID)= [表格]![客户信息]!

[IJ / JOInformation] .form。[joid]));"
Can anyone help with this statement? I get a syntax error message.....not
good at this at all.
Thanks

DoCmd.RunSQL "Update JOTable" _
& "INNER JOIN [Attendance Follow Up] ON JOTable.JOID = [Attendance Follow Up].
JOID " _
& "Set [Attendance Follow Up].ActEndDate = "jotable.ActEndDate "" _
& "WHERE ((([Attendance Follow Up].JOID)=[forms]![clientinformation]!
[IJ/JOInformation].form.[joid]));"



1.跳过jotable.ActEndDate周围的报价。

2.跳过表格在控件参考中。

3.在JOTable和INNER JOIN之间添加一个空格。

4.删除括号,在这种情况下不需要。

5.使用DB对象的.Execute方法而不是DoCmd.RunSQL。


Dim Db作为DAO.Database

设置Db = CurrentDb


Db.Execute"更新JOTable INNER JOIN [出勤跟进]" &安培; _

" ON JOTable.JOID = [出勤跟进] .JOID &安培; _

" SET [出勤跟进] .ActEndDate = JOTable.ActEndDate" &安培; _

"在哪里[出勤跟进] .JOID =" &安培; _

" [表格]![ClientInformation]![IJ / JOInformation]![joid];",_

dbFailOnError


设置Db = Nothing


-

Peter Doering [MVP访问]

1. Skip the quotes around jotable.ActEndDate.
2. Skip the "form" in the control reference.
3. Add a blank between JOTable and INNER JOIN.
4. Drop the parentheses, not necessary in this case.
5. Use the .Execute method of the DB object instead of DoCmd.RunSQL.

Dim Db As DAO.Database
Set Db = CurrentDb

Db.Execute "UPDATE JOTable INNER JOIN [Attendance Follow Up] " & _
" ON JOTable.JOID = [Attendance Follow Up].JOID " & _
" SET [Attendance Follow Up].ActEndDate = JOTable.ActEndDate " & _
" WHERE [Attendance Follow Up].JOID =" & _
" [Forms]![ClientInformation]![IJ/JOInformation]![joid];", _
dbFailOnError

Set Db = Nothing

--
Peter Doering [MVP Access]


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

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