更新查询 [英] Update query

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

问题描述

帮助,我想从表单运行更新查询..

并且很奇怪..


如果我想要更新查询可以运行更新手动输入的值

从表格(例如[Forms]![frmUpdatePW]![txtConfirmPW])到表格

(tblPasswordMgmt.Password)


但是基于既不是两个值的标准。相反,它是([表格]![frmUpdatePW]![txtusername] = tblPasswordMgmt.UserID)。


简而言之,


UPDATE tblPasswordMgmt

SET(Qn:命令SET是SET TO还是SET FROM?)

WHERE(Qn:可以命令WHERE被指定哪个与我想要更新的值无关?




查询可以拔出吗?从表单中更新

的值是否仅限于表中的特定字段?并且此特定字段

必须与用户输入的另一个值匹配,该值与表中另一个

字段匹配,然后更新表中的字段。


Thanxs Lotsa!

解决方案

2006年1月21日06:06:02 -0800,Darren <叶******** @ gmail.com>写道:

帮助,我想从表单运行更新查询..
并且很奇怪..

更新查询可以运行如果我想从表格(例如[Forms]![frmUpdatePW]![txtConfirmPW])更新手动输入的值到表格
(tblPasswordMgmt.Password)

但是基于既不是两个值的标准。相反,它就像([Forms]![frmUpdatePW]![txtusername] = tblPasswordMgmt.UserID)。简而言之,

更新tblPasswordMgmt
SET(Qn:命令SET是SET TO还是SET FROM?)
WHERE(Qn:可以指定WHERE命令,它与我想要更新的值无关?)

查询可以拔出吗?表单中的值是否专门更新到表中的特定字段?
Thanxs Lotsa!


如果值是字符串,则需要将控制引用括在引号中。 (我使用Chr(34)

strSQL =" UPDATE tblPasswordMgmt" _

&" SET [SomeField] ="& Chr (34)& Me。[txtConfirmPW] .Value& Chr(34)&"" _

&" WHERE [UserID] ="& Chr(34) & Me.txtusername& Chr(34)&" ;;"


CurrentDB.Execute strSQL,dbFailOnError

Wayne Gillespie

Gosford NSW澳大利亚


2006年1月21日星期六15:48:32 GMT,Wayne Gillespie< be ***** @ NOhotmailSPAM.com。 au>写道:

2006年1月21日06:06:02 -0800,Darren< Ye ******** @ gmail.com>写道:

帮助,我想从表单运行更新查询..
并且很奇怪..

如果我可以运行更新查询想要从表格(例如[Forms]![frmUpdatePW]![txtConfirmPW])更新手动输入的值到表格
(tblPasswordMgmt.Password)

b ut基于既不是两个值的标准。相反,它就像([Forms]![frmUpdatePW]![txtusername] = tblPasswordMgmt.UserID)。简而言之,

更新tblPasswordMgmt
SET(Qn:命令SET是SET TO还是SET FROM?)
WHERE(Qn:可以指定WHERE命令,它与我想要更新的值无关?)

查询可以拔出吗?表单中的值是否专门更新到表中的特定字段?
Thanxs Lotsa!


如果值是字符串,则需要将控制引用括在引号中。 (我使用Chr(34)

strSQL =" UPDATE tblPasswordMgmt" _
&" SET [SomeField] ="& Chr(34)& Me。[ txtConfirmPW] .Value& Chr(34)&"" _
&" WHERE [UserID] ="& Chr(34)& Me.txtusername& Chr(34)& ;""

CurrentDB.Execute strSQL,dbFailOnError

Wayne Gillespie
Gosford NSW Australia




应该是


strSQL =" UPDATE tblPasswordMgmt" _

&" SET [Password] ="& Chr(34 )& Me。[txtConfirmPW] .Value& Chr(34)&"" _

&" WHERE [UserID] ="& Chr(34)& Me.txtusername& Chr(34)&" ;;"


CurrentDB.Execute strSQL,dbFailOnError

Wayne Gillespie

Gosford NSW Australia


它应该在一个模块中,还是可以在一个宏中,使用runSQL代码:

str SQL =" UPDATE tblPasswordMgmt" _

& SET [SomeField] =" &安培; Chr(34)&我。[txtConfirmPW] .Value& Chr(34)

& " " _

& WHERE [UserID] =" &安培; Chr(34)& Me.txtusername& Chr(34)& " ;;"

如果我将它放在查询中,它会提示输入无效的SQL

表达式


Help, i want to run an update query from a form..
and was wonderin..

Can the update query run if i want to update a value manually inputted
from a form (e.g. [Forms]![frmUpdatePW]![txtConfirmPW]) to a table
(tblPasswordMgmt.Password)

but based on a criteria which is neither the two values. Instead it''s
like ([Forms]![frmUpdatePW]![txtusername]=tblPasswordMgmt.UserID).

in a nutshell,

UPDATE tblPasswordMgmt
SET (Qn : The command SET is it SET TO or SET FROM?)
WHERE (Qn : Can the command WHERE be specified which has no relevance
to the value that i want to update?)

Can the query "plucked out" the value from the form to update
exclusively to a specific field in the table? and this specific field
must match another value input by the user which matches to another
field in the table before updating the field in the table.

Thanxs Lotsa!

解决方案

On 21 Jan 2006 06:06:02 -0800, "Darren" <Ye********@gmail.com> wrote:

Help, i want to run an update query from a form..
and was wonderin..

Can the update query run if i want to update a value manually inputted
from a form (e.g. [Forms]![frmUpdatePW]![txtConfirmPW]) to a table
(tblPasswordMgmt.Password)

but based on a criteria which is neither the two values. Instead it''s
like ([Forms]![frmUpdatePW]![txtusername]=tblPasswordMgmt.UserID).

in a nutshell,

UPDATE tblPasswordMgmt
SET (Qn : The command SET is it SET TO or SET FROM?)
WHERE (Qn : Can the command WHERE be specified which has no relevance
to the value that i want to update?)

Can the query "plucked out" the value from the form to update
exclusively to a specific field in the table? and this specific field
must match another value input by the user which matches to another
field in the table before updating the field in the table.

Thanxs Lotsa!


If the values are strings you need to wrap the control refrerences in quotes. (I use Chr(34)

strSQL ="UPDATE tblPasswordMgmt " _
& "SET [SomeField]=" & Chr(34) & Me.[txtConfirmPW].Value & Chr(34) & " " _
& "WHERE [UserID]=" & Chr(34) & Me.txtusername & Chr(34) & ";"

CurrentDB.Execute strSQL, dbFailOnError
Wayne Gillespie
Gosford NSW Australia


On Sat, 21 Jan 2006 15:48:32 GMT, Wayne Gillespie <be*****@NOhotmailSPAM.com.au> wrote:

On 21 Jan 2006 06:06:02 -0800, "Darren" <Ye********@gmail.com> wrote:

Help, i want to run an update query from a form..
and was wonderin..

Can the update query run if i want to update a value manually inputted
from a form (e.g. [Forms]![frmUpdatePW]![txtConfirmPW]) to a table
(tblPasswordMgmt.Password)

but based on a criteria which is neither the two values. Instead it''s
like ([Forms]![frmUpdatePW]![txtusername]=tblPasswordMgmt.UserID).

in a nutshell,

UPDATE tblPasswordMgmt
SET (Qn : The command SET is it SET TO or SET FROM?)
WHERE (Qn : Can the command WHERE be specified which has no relevance
to the value that i want to update?)

Can the query "plucked out" the value from the form to update
exclusively to a specific field in the table? and this specific field
must match another value input by the user which matches to another
field in the table before updating the field in the table.

Thanxs Lotsa!


If the values are strings you need to wrap the control refrerences in quotes. (I use Chr(34)

strSQL ="UPDATE tblPasswordMgmt " _
& "SET [SomeField]=" & Chr(34) & Me.[txtConfirmPW].Value & Chr(34) & " " _
& "WHERE [UserID]=" & Chr(34) & Me.txtusername & Chr(34) & ";"

CurrentDB.Execute strSQL, dbFailOnError
Wayne Gillespie
Gosford NSW Australia



Should be

strSQL ="UPDATE tblPasswordMgmt " _
& "SET [Password]=" & Chr(34) & Me.[txtConfirmPW].Value & Chr(34) & " " _
& "WHERE [UserID]=" & Chr(34) & Me.txtusername & Chr(34) & ";"

CurrentDB.Execute strSQL, dbFailOnError
Wayne Gillespie
Gosford NSW Australia


Hi, should it be in a module or can it be in a macro, with runSQL code:
strSQL ="UPDATE tblPasswordMgmt " _
& "SET [SomeField]=" & Chr(34) & Me.[txtConfirmPW].Value & Chr(34)
& " " _
& "WHERE [UserID]=" & Chr(34) & Me.txtusername & Chr(34) & ";"
And if i were to place it in a query, it prompts for an invalid SQL
expression


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

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