使用表单中的字符串数据更新备注字段时出现问题 [英] Problem updating memo field with string data from form

查看:66
本文介绍了使用表单中的字符串数据更新备注字段时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表格中有一个备忘录字段,用于记录社交工作者与客户进行的对话中的笔记(这是非营利性的)。

如果用户需要更新备忘录字段,我需要找到

原始记录(我做得很好 - 获得正确的密钥)



我需要更新笔记使用表单中的新值,我将
存储在字符串变量中。


(我已尝试存储在Variant变量中;没有'对我有用)


我得到了我需要的信息,关闭表单,然后运行SQL,我得到类型

标准不匹配 ;。


我很困惑(好吧,它并不需要太多!)[以下代码]


任何帮助都是非常感谢。


谢谢 -

Sara


''首先,保存初始通话记录 - 更新

DoCmd.RunCommand acCmdSaveRecord

lngClientKey = Me.txtClientKey

lngInteractionKey = DLookup(" InteractionKey",

" tblInteractionHistory",_

" ClientKey ="& lngClientKey&" AND InteractionTypeKey =

6")


strPresProblem = Me.txtPresentingProblem


''******* ???????? *** ???


''ON UPDATE初始调用,更新交互中呈现问题

历史记录(仅审计在初始调用信息审计记录中)


''******* ???????? *** ???

DoCmd.Close acForm,Me.Name


strSQL =" UPDATE tblInteractionHistory" _

& " SET tblInteractionHistory.Notes =" &安培; strPresProblem& "

_

& " WHERE tblInteractionHistory.InteractionKey =" &

lngInteractionKey

DoCmd.RunCommand strSQL

I have a Memo field in a table to hold notes from a conversation a
social worker has had with a client (this is for a non-profit).

If the user needs to update the memo field, I need to find the
original record (which I am doing fine - getting the correct key)
and
I need to update the "notes" with the new value from the form, which I
store in a String Variable.

(I''ve tried storing in a Variant variable; didn''t work for me)

I get the info I need, close the form, and run the SQL and I get "Type
Mismatch in Criteria".

I''m baffled (ok, it doesn''t take much!) [Code below]

Any help is much appreciated.

Thanks -
Sara

'' First, save the Initial call record - with updates
DoCmd.RunCommand acCmdSaveRecord

lngClientKey = Me.txtClientKey
lngInteractionKey = DLookup("InteractionKey",
"tblInteractionHistory", _
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6")

strPresProblem = Me.txtPresentingProblem

'' *******???????? ***???

'' ON UPDATE initial call, update Presenting problem in Interaction
History (only audit is in Initial Call info audit record)

'' *******???????? ***???
DoCmd.Close acForm, Me.Name

strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = " & strPresProblem & ""
_
& " WHERE tblInteractionHistory.InteractionKey = " &
lngInteractionKey
DoCmd.RunCommand strSQL

推荐答案

Sara,


为什么你要通过这条迂回路线更新字段?


将表格打开到正确的记录要简单得多,显示

现有的备忘录字段数据,在锁定的文本框中,允许

用户在未绑定的文本框中添加评论,然后只需

使用


me将更新连接到绑定的文本框!memofield = me!memofield&我!添加字段

me.dirty = false

in -click of a"保存添加内容 CommandButton


如果你允许用户编辑现有的

备忘录字段,那就简单了。

如果你坚持按照你的方式,将Docmd.Close

,me.name移到DoCmd.RunSQL之后。

Q


sara< sa ******* @ yahoo.comwrote in

新闻:11 ********************** @ k79g2000hse.googlegr psps.com:
Sara,

why are you going this circuitous route to update a field?

It''s far simpler to open a form to the correct record, Display
the existing memo field data, in a locked textbox, allow the
user to add comments in an unbound textbox, then simply
concatenate the update to the bound textbox using

me!memofield = me!memofield & me!additionfield
me.dirty = false

in the on_click of a " save additions" CommandButton

It''s even simpler if you allow the user to edit the existing
memo field.
If you insist in doing it your way, move the Docmd.Close
,me.name to after the DoCmd.RunSQL.
Q

sara <sa*******@yahoo.comwrote in
news:11**********************@k79g2000hse.googlegr oups.com:

我在表格中有一个备忘录字段,用于记录社交工作者的

对话中的备注有一个客户(这是非盈利的
)。


如果用户需要更新备忘录字段,我需要找到

原始记录(我做得很好 - 得到正确的

键)和

我需要更新注释使用表单中的新值,

我存储在字符串变量中。


(我已经尝试存储在Variant变量中;没有'对我有用。


我得到了我需要的信息,关闭表格,然后运行SQL和我

得到标准中的类型不匹配 ;。


我很困惑(好吧,它并不需要太多!)[以下代码]


任何帮助都是非常感谢。


谢谢 -

Sara


''首先,保存初始通话记录 - 更新

DoCmd.RunCommand acCmdSaveRecord

lngClientKey = Me.txtClientKey

lngInteractionKey = DLookup(" InteractionKey",

" tblInteractionHistory",_

" ClientKey ="& lngClientKey&" AND

InteractionTypeKey =

6)


strPresProblem = Me.txtPresentingProblem


''*** **** ???????? *** ???


''ON UPDATE初始调用,更新提交问题

交互历史记录(仅审计在初始呼叫信息审计中

记录)


''******* ???????? *** ???


DoCmd.Close acForm,Me.Name


strSQL =" UPDATE tblInteractionHistory" _

& " SET tblInteractionHistory.Notes =" &

strPresProblem& "

_

& " WHERE tblInteractionHistory.InteractionKey =" &

lngInteractionKey


DoCmd.RunCommand strSQL

I have a Memo field in a table to hold notes from a
conversation a social worker has had with a client (this is
for a non-profit).

If the user needs to update the memo field, I need to find the
original record (which I am doing fine - getting the correct
key) and
I need to update the "notes" with the new value from the form,
which I store in a String Variable.

(I''ve tried storing in a Variant variable; didn''t work for me)

I get the info I need, close the form, and run the SQL and I
get "Type Mismatch in Criteria".

I''m baffled (ok, it doesn''t take much!) [Code below]

Any help is much appreciated.

Thanks -
Sara

'' First, save the Initial call record - with updates
DoCmd.RunCommand acCmdSaveRecord

lngClientKey = Me.txtClientKey
lngInteractionKey = DLookup("InteractionKey",
"tblInteractionHistory", _
"ClientKey = " & lngClientKey & " AND
InteractionTypeKey =
6")

strPresProblem = Me.txtPresentingProblem

'' *******???????? ***???

'' ON UPDATE initial call, update Presenting problem in
Interaction History (only audit is in Initial Call info audit
record)

'' *******???????? ***???
DoCmd.Close acForm, Me.Name

strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = " &
strPresProblem & ""
_
& " WHERE tblInteractionHistory.InteractionKey = " &
lngInteractionKey
DoCmd.RunCommand strSQL




-

Bob Quintal


PA是我改变了我的电子邮件地址。


- -

通过http://www.teranews.com上的免费Usenet帐户发布



--
Bob Quintal

PA is y I''ve altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com


sara< sa ** *****@yahoo.com写的

新闻:11 ********************* @ 57g2000hsv.googlegrou ps.com:
sara <sa*******@yahoo.comwrote in
news:11*********************@57g2000hsv.googlegrou ps.com:

>

Bob -

感谢您的回复。


我做了你说的话,仍然得到了类型不匹配。错误。
>
Bob -
Thanks for the response.

I did what you said and still get the "type Mismatch" error.



我只是想知道SQL

的更新部分的语法是错误的,但是却抛出了错误的信息。

无论如何,为了调试这个,首先把一些额外的格式化为

的SQL语句


strSQL =" UPDATE tblInteractionHistory" &安培; vbNewLine _

& SET tblInteractionHistory.Notes =" &安培; vbNewLine _

& strPresProblem& vbNewLine _

& " WHERE tblInteractionHistory.InteractionKey =" _

& lngInteractionKey& ""


debug.print strSQL


Docmd.RunSQL strSQL


运行代码。打开即时窗口{ctrl-G}键

检查传递给runSQL

语句的实际sql。也许我们可以看到问题。

Im just wondering if the syntax of the Update section of the SQL
is wrong but throwing up the wrong message.
anyway, to debug this, first put some additional formatting into
the SQL statement

strSQL = "UPDATE tblInteractionHistory " & vbNewLine _
& "SET tblInteractionHistory.Notes = " & vbNewLine _
& strPresProblem & vbNewLine _
& " WHERE tblInteractionHistory.InteractionKey = " _
& lngInteractionKey & ";"

debug.print strSQL

Docmd.RunSQL strSQL

Run the code. Opem the immediate window {ctrl-G} key
Examine the actual sql that''s being passed to the runSQL
statement. Maybe we can see the problem.


>

我仍​​然可能工作太辛苦 (我相当没经验,

所以我经常听到这个!),但是让我解释一下这个上发生了什么。

>
I still may be "working too hard" (I''m fairly inexperienced,
so I hear that rather often!), but let me explain what''s
happening on this one.



[snipped]

[snipped]


>

有意义吗? (这个组织太棒了 - 为许多人很快就会忘记或愿意去的人提供

服务

离开,我正在努力尽我所能,以便他们的

钱去了最需要的地方。


长解释!非常感谢 -

Sara

>
Make sense? (This organization is so amazing - providing
services for people many would soon forget or wish would go
away, that I am trying to do everything I can so that their
money goes where it''s needed most).

Long explanation! Many thanks -
Sara




-

Bob Quintal


PA是我改变了我的电子邮件地址。


-

通过免费的Usenet帐户发布来自 http://www.teranews.com



--
Bob Quintal

PA is y I''ve altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com


7月16日下午4:32,Bob Quintal< rquin ... @ sPAmpatico.cawrote:
On Jul 16, 4:32 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:

sara< saraqp ... @ yahoo.comwrote innews:11 ********************* @ 57g2000hsv.googlegr oups.com:
sara <saraqp...@yahoo.comwrote innews:11*********************@57g2000hsv.googlegr oups.com:

鲍勃 -

感谢您的回复。
Bob -
Thanks for the response.


我做了你说的话,仍然得到类型不匹配错误。
I did what you said and still get the "type Mismatch" error.



我只是想知道SQL

的更新部分的语法是错误的,但是却抛出了错误的信息。


无论如何,为了调试这个,先把一些额外的格式化到

的SQL语句中


strSQL =" UPDATE tblInteractionHistory" ; &安培; vbNewLine _

& SET tblInteractionHistory.Notes =" &安培; vbNewLine _

& strPresProblem& vbNewLine _

& " WHERE tblInteractionHistory.InteractionKey =" _

& lngInteractionKey& ""


debug.print strSQL


Docmd.RunSQL strSQL


运行代码。打开即时窗口{ctrl-G}键

检查传递给runSQL

语句的实际sql。也许我们可以看到问题。


Im just wondering if the syntax of the Update section of the SQL
is wrong but throwing up the wrong message.

anyway, to debug this, first put some additional formatting into
the SQL statement

strSQL = "UPDATE tblInteractionHistory " & vbNewLine _
& "SET tblInteractionHistory.Notes = " & vbNewLine _
& strPresProblem & vbNewLine _
& " WHERE tblInteractionHistory.InteractionKey = " _
& lngInteractionKey & ";"

debug.print strSQL

Docmd.RunSQL strSQL

Run the code. Opem the immediate window {ctrl-G} key
Examine the actual sql that''s being passed to the runSQL
statement. Maybe we can see the problem.


我仍​​然可能工作太辛苦 (我相当缺乏经验,

所以我经常听到!),但是让我解释一下这个上发生了什么。
I still may be "working too hard" (I''m fairly inexperienced,
so I hear that rather often!), but let me explain what''s
happening on this one.



[snipped]


[snipped]


有意义吗? (这个组织太棒了 - 为许多人很快就会忘记或愿意去的人提供

服务

离开,我正在努力尽我所能,以便他们的

钱去了最需要的地方。
Make sense? (This organization is so amazing - providing
services for people many would soon forget or wish would go
away, that I am trying to do everything I can so that their
money goes where it''s needed most).


冗长的解释!非常感谢 -

Sara
Long explanation! Many thanks -
Sara



-

Bob Quintal


PA是y我已经改变了我的电子邮件地址。


-

通过免费的Usenet帐户发布来自http://www.teranews。 com


--
Bob Quintal

PA is y I''ve altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com



感谢回复,鲍勃。这刚刚出现(我注意到帖子

最近被严重拖延)。我想知道是否希望你能回复,我现在就可以开始工作并回复了。


sara

Thanks for the reply, Bob. This just appeared (I''ve noticed posts
have been severely delayed lately). I was wondering if and hoping you
would reply, and I''ll now get to work on this and post back.

sara


这篇关于使用表单中的字符串数据更新备注字段时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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