473,473 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem updating memo field with string data from form

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

Jul 15 '07 #1
15 7315
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:
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 is y I've altered my email address.

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

Jul 16 '07 #2
sara <sa*******@yahoo.comwrote in
news:11*********************@57g2000hsv.googlegrou ps.com:
>
Bob -
Thanks for the response.

I did what you said and still get the "type Mismatch" error.
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]
>
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 is y I've altered my email address.

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

Jul 17 '07 #3
On Jul 16, 4:32 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:
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.

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]
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 is y I've altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com
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

Jul 19 '07 #4
On Jul 16, 4:32 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:
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.

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]
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 is y I've altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com
Bob -
My other post hasn't appeared yet, but I have been working on your
suggestion:

?strsql
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
This is his problem on 719 upodating pores prob
WHERE tblInteractionHistory.InteractionKey =
36;

"This is his problem on 719 upodating pores prob" is the data I want
to REPLACE (Update to) in the memo field tblInteractionHistory.Notes.

I am wondering if I need (somehow) to have the SQL have "This is his
problem...." in quotes. I tried a few ideas, but couldn't get it.

Could that be it?

Sara

Jul 19 '07 #5
Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:

1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"

2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"

Note that this: "" has a similar function to '

The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""

-John
Jul 19 '07 #6
On Jul 19, 1:46 pm, John Welch <so...@nospam.comwrote:
Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:

1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"

2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"

Note that this: "" has a similar function to '

The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""

-John
John -
I was Hugely excited to see that a) I might have figured something out
and b) you gave me more info about the ' vs ".

I tried it
?strSQl
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
" & strPresProblem & "" & vbNewLine WHERE
tblInteractionHistory.InteractionKey = 86;

And still get the same error ("Type mismatch")
One question - Why the "double Quote" after strPresProblem in the
resolved SQL string? Could this be part of the problem?
" & strPresProblem & ""

Sara

Jul 20 '07 #7
Hi Sara, oops, I had a mistake in what I sent you. Because I didn't
include the WHERE clause I had the quotes wrong for your situation. You
wouldn't want to close them off before the WHERE, so there should only
be three right before the WHERE (the first starts a new string and the
second 2 are like ' . You got it right again!

Try using this SQL:
strSQL = "UPDATE tblInteractionHistory SET tblInteractionHistory.Notes =
""" & strPresProblem & """ WHERE tblInteractionHistory.InteractionKey =
" & lngInteractionKey
-John

sara wrote:
On Jul 19, 1:46 pm, John Welch <so...@nospam.comwrote:
>Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:

1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"

2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"

Note that this: "" has a similar function to '

The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""

-John

John -
I was Hugely excited to see that a) I might have figured something out
and b) you gave me more info about the ' vs ".

I tried it
?strSQl
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
" & strPresProblem & "" & vbNewLine WHERE
tblInteractionHistory.InteractionKey = 86;

And still get the same error ("Type mismatch")
One question - Why the "double Quote" after strPresProblem in the
resolved SQL string? Could this be part of the problem?
" & strPresProblem & ""

Sara
Jul 20 '07 #8
On Jul 20, 12:23 pm, John Welch <so...@nospam.comwrote:
Hi Sara, oops, I had a mistake in what I sent you. Because I didn't
include the WHERE clause I had the quotes wrong for your situation. You
wouldn't want to close them off before the WHERE, so there should only
be three right before the WHERE (the first starts a new string and the
second 2 are like ' . You got it right again!

Try using this SQL:
strSQL = "UPDATE tblInteractionHistory SET tblInteractionHistory.Notes =
""" & strPresProblem & """ WHERE tblInteractionHistory.InteractionKey =
" & lngInteractionKey

-John

sara wrote:
On Jul 19, 1:46 pm, John Welch <so...@nospam.comwrote:
Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:
1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"
2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"
Note that this: "" has a similar function to '
The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""
-John
John -
I was Hugely excited to see that a) I might have figured something out
and b) you gave me more info about the ' vs ".
I tried it
?strSQl
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
" & strPresProblem & "" & vbNewLine WHERE
tblInteractionHistory.InteractionKey = 86;
And still get the same error ("Type mismatch")
One question - Why the "double Quote" after strPresProblem in the
resolved SQL string? Could this be part of the problem?
" & strPresProblem & ""
Sara- Hide quoted text -

- Show quoted text -
John -
Still getting the same error! (Type Mismatch)

SQL resolves to:
UPDATE tblInteractionHistory SET tblInteractionHistory.Notes = "This
is his problem. Testing key = 86 - 1" WHERE
tblInteractionHistory.InteractionKey =86

Code: (I copied yours and tried it with no continuation characters,
and finally like this so I could see all the code in the window)

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

It seems SO simple ! Update a field - and the SQL looks fine (to me,
at least).

Any ideas now? I even Decompiled and recompiled.

sara

Jul 20 '07 #9
Well now the problem with the notes is fixed. I reread your original
post and realized that the error you got was "type mismatch in
criteria", which means the mismatch is in the Where clause. So it isn't
liking

WHERE tblInteractionHistory.InteractionKey =" & lngInteractionKey

are you sure the field InteractionKey in tblInteractionHistory is a long
integer type field? and that the variable lngInteractionKey is really
a long int variable?

-john

sara wrote:
On Jul 20, 12:23 pm, John Welch <so...@nospam.comwrote:
>Hi Sara, oops, I had a mistake in what I sent you. Because I didn't
include the WHERE clause I had the quotes wrong for your situation. You
wouldn't want to close them off before the WHERE, so there should only
be three right before the WHERE (the first starts a new string and the
second 2 are like ' . You got it right again!

Try using this SQL:
strSQL = "UPDATE tblInteractionHistory SET tblInteractionHistory.Notes =
""" & strPresProblem & """ WHERE tblInteractionHistory.InteractionKey =
" & lngInteractionKey

-John

sara wrote:
>>On Jul 19, 1:46 pm, John Welch <so...@nospam.comwrote:
Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:
1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"
2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"
Note that this: "" has a similar function to '
The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""
-John
John -
I was Hugely excited to see that a) I might have figured something out
and b) you gave me more info about the ' vs ".
I tried it
?strSQl
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
" & strPresProblem & "" & vbNewLine WHERE
tblInteractionHistory.InteractionKey = 86;
And still get the same error ("Type mismatch")
One question - Why the "double Quote" after strPresProblem in the
resolved SQL string? Could this be part of the problem?
" & strPresProblem & ""
Sara- Hide quoted text -
- Show quoted text -

John -
Still getting the same error! (Type Mismatch)

SQL resolves to:
UPDATE tblInteractionHistory SET tblInteractionHistory.Notes = "This
is his problem. Testing key = 86 - 1" WHERE
tblInteractionHistory.InteractionKey =86

Code: (I copied yours and tried it with no continuation characters,
and finally like this so I could see all the code in the window)

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

It seems SO simple ! Update a field - and the SQL looks fine (to me,
at least).

Any ideas now? I even Decompiled and recompiled.

sara
Jul 20 '07 #10
On Jul 20, 4:23 pm, John Welch <so...@nospam.comwrote:
Well now the problem with the notes is fixed. I reread your original
post and realized that the error you got was "type mismatch in
criteria", which means the mismatch is in the Where clause. So it isn't
liking

WHERE tblInteractionHistory.InteractionKey =" & lngInteractionKey

are you sure the field InteractionKey in tblInteractionHistory is a long
integer type field? and that the variable lngInteractionKey is really
a long int variable?

-john

sara wrote:
On Jul 20, 12:23 pm, John Welch <so...@nospam.comwrote:
Hi Sara, oops, I had a mistake in what I sent you. Because I didn't
include the WHERE clause I had the quotes wrong for your situation. You
wouldn't want to close them off before the WHERE, so there should only
be three right before the WHERE (the first starts a new string and the
second 2 are like ' . You got it right again!
Try using this SQL:
strSQL = "UPDATE tblInteractionHistory SET tblInteractionHistory.Notes =
""" & strPresProblem & """ WHERE tblInteractionHistory.InteractionKey =
" & lngInteractionKey
-John
sara wrote:
On Jul 19, 1:46 pm, John Welch <so...@nospam.comwrote:
Sara, you are correct - your type mismatch problem comes because you
need to have quotes around any text in your SQL string. There are two
ways to do this:
1
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = '" & strPresProblem & "'"
2
strSQL = "UPDATE tblInteractionHistory " _
& " SET tblInteractionHistory.Notes = """ & strPresProblem & """"
Note that this: "" has a similar function to '
The advantage to "" is that if the notes have already have the
'(apostrophe) character, the sql will crash if you use the ' but not the ""
-John
John -
I was Hugely excited to see that a) I might have figured something out
and b) you gave me more info about the ' vs ".
I tried it
?strSQl
UPDATE tblInteractionHistory
SET tblInteractionHistory.Notes =
" & strPresProblem & "" & vbNewLine WHERE
tblInteractionHistory.InteractionKey = 86;
And still get the same error ("Type mismatch")
One question - Why the "double Quote" after strPresProblem in the
resolved SQL string? Could this be part of the problem?
" & strPresProblem & ""
Sara- Hide quoted text -
- Show quoted text -
John -
Still getting the same error! (Type Mismatch)
SQL resolves to:
UPDATE tblInteractionHistory SET tblInteractionHistory.Notes = "This
is his problem. Testing key = 86 - 1" WHERE
tblInteractionHistory.InteractionKey =86
Code: (I copied yours and tried it with no continuation characters,
and finally like this so I could see all the code in the window)
strSQL = "UPDATE tblInteractionHistory SET
tblInteractionHistory.Notes = """ & strPresProblem & """ " _
& " WHERE tblInteractionHistory.InteractionKey =" &
lngInteractionKey
It seems SO simple ! Update a field - and the SQL looks fine (to me,
at least).
Any ideas now? I even Decompiled and recompiled.
sara- Hide quoted text -

- Show quoted text -
John -
InteractionKey in the table is the key to the table and is an
AutoNumber.

Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)

lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).

So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)

Next?

Sara

Jul 20 '07 #11
I'm running out of ideas. One thing to try is to take the resolved SQL
and copy and paste it into the query builder as a new query then try to
run it from there. It sometimes gives you more information than the vb
error message.

-john

sara wrote:
John -
InteractionKey in the table is the key to the table and is an
AutoNumber.

Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)

lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).

So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)

Next?

Sara
Jul 20 '07 #12
On Jul 20, 6:08 pm, John Welch <so...@nospam.comwrote:
I'm running out of ideas. One thing to try is to take the resolved SQL
and copy and paste it into the query builder as a new query then try to
run it from there. It sometimes gives you more information than the vb
error message.

-john

sara wrote:
John -
InteractionKey in the table is the key to the table and is an
AutoNumber.
Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)
lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).
So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)
Next?
Sara- Hide quoted text -

- Show quoted text -
John -
I did that,

UPDATE tblInteractionHistory SET tblInteractionHistory.Notes = "This
is his problem. Testing key = 86 -7" WHERE
tblInteractionHistory.InteractionKey =86

and it works just fine and dandy.

SO,?????/

I also tried to "resolve" the fields - I had this idea that since the
form was updating tblInitialCall.PresentingProblem, I could make an
update query and have tblInteractionHistory.Notes update to
tblInitialCall.PresentingProblem. Not working - but that's for 2
reasons:

1. I can't figure out how to get the DMAX (find the highest key on
interactionHistory with a type of 6 )- so I update the corret record
on interactionHistory

2. I JUST tried to get the Client Key (trying to break it down and do
one little thing at a time) from the form. Form frminitialcall is
OPEN with a record. I run a Select Query and JUST try to get the
value for: forms]![frmUpdateInitialCall].[txtClientKey]

SELECT [forms]![frmUpdateInitialCall].[txtClientKey] AS unk;

And the result is a Martian Character:

THIS seems to be the problem! But why?

*** I ALSO tried:

UPDATE tblInteractionHistory INNER JOIN tblInitialCallInfo ON
tblInteractionHistory.ClientKey = tblInitialCallInfo.ClientKey SET
tblInteractionHistory.Notes = [tblInitialCallInfo].[CallerPresProblem]
WHERE (((tblInitialCallInfo.CallerKey)=[forms]![frmUpdateInitialCall].
[txtCallerKey]));

Which runs, but since there are 2 InitialCall (type 6) records, it
wants to update BOTH of them.
When I add the criteria (DMAX problem here) to get just the RIGHT
InteractionHistory record, I get NO record selected (I'm guessing it's
my KEY field on the form).

UPDATE tblInteractionHistory INNER JOIN tblInitialCallInfo ON
tblInteractionHistory.ClientKey = tblInitialCallInfo.ClientKey SET
tblInteractionHistory.Notes = [tblInitialCallInfo].[CallerPresProblem]
WHERE (((tblInitialCallInfo.CallerKey)=[forms]![frmUpdateInitialCall].
[txtCallerKey]) AND
((tblInteractionHistory.InteractionKey)=DMax("Inte ractionKey","tblInteractionHistory",
("ClientKey"=[forms]![frmUpdateInitialCall].[txtClientKey]) And
("InteractionTypeKey"=6))));

I *feel* like I'm narrowing in on the problem, but just can't get that
last little piece to fit. The problem is just "Type Mismatch" - not
"in Criteria" now.

Also, I did delete and re-add the callerKey and ClientKey fields on
the form - just in case it was bad or something. No change.

Are we getting somewhere? (I know it's Sunday - I generally work on
this app nights and weekends since it's volunteer work ...)

Sara

Jul 22 '07 #13
On Jul 20, 6:08 pm, John Welch <so...@nospam.comwrote:
I'm running out of ideas. One thing to try is to take the resolved SQL
and copy and paste it into the query builder as a new query then try to
run it from there. It sometimes gives you more information than the vb
error message.

-john

sara wrote:
John -
InteractionKey in the table is the key to the table and is an
AutoNumber.
Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)
lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).
So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)
Next?
Sara- Hide quoted text -

- Show quoted text -
I did it!!! Well, more accurately, you helped and Allen Browne
provided the final solution - let me explain.

I had another problem where an Update query wasn't working - never
connected the two problems. Allen was hjelping me with the other and
pointed me toward his site:
http://allenbrowne.com/ser-60.html
to learn a bit about dbExecute.

I applied the concept to my work problem, and somehow managed to
connect the concept to this db. It works! SO, now I do:

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

Set db = DBEngine(0)(0)
db.Execute strSQL, dbFailOnError
MsgBox db.RecordsAffected & " record(s) updated."
Set db = Nothing

And it updates!! I am so excited, I can barely contain myself (next
stop, I'll go get a Life!).

Anyway, thanks so much for sticking this out with me! I hope this
makes sense to you as a solution as well. It works!

sara

Jul 23 '07 #14
Good catch. I got so caught up on the SQL that I didn't notice the
docmd.runcommand
-john

sara wrote:
On Jul 20, 6:08 pm, John Welch <so...@nospam.comwrote:
>I'm running out of ideas. One thing to try is to take the resolved SQL
and copy and paste it into the query builder as a new query then try to
run it from there. It sometimes gives you more information than the vb
error message.

-john

sara wrote:
>>John -
InteractionKey in the table is the key to the table and is an
AutoNumber.
Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)
lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).
So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)
Next?
Sara- Hide quoted text -
- Show quoted text -

I did it!!! Well, more accurately, you helped and Allen Browne
provided the final solution - let me explain.

I had another problem where an Update query wasn't working - never
connected the two problems. Allen was hjelping me with the other and
pointed me toward his site:
http://allenbrowne.com/ser-60.html
to learn a bit about dbExecute.

I applied the concept to my work problem, and somehow managed to
connect the concept to this db. It works! SO, now I do:

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

Set db = DBEngine(0)(0)
db.Execute strSQL, dbFailOnError
MsgBox db.RecordsAffected & " record(s) updated."
Set db = Nothing

And it updates!! I am so excited, I can barely contain myself (next
stop, I'll go get a Life!).

Anyway, thanks so much for sticking this out with me! I hope this
makes sense to you as a solution as well. It works!

sara
Jul 23 '07 #15
On Jul 23, 8:15 pm, John Welch <so...@nospam.comwrote:
Good catch. I got so caught up on the SQL that I didn't notice the
docmd.runcommand
-john

sara wrote:
On Jul 20, 6:08 pm, John Welch <so...@nospam.comwrote:
I'm running out of ideas. One thing to try is to take the resolved SQL
and copy and paste it into the query builder as a new query then try to
run it from there. It sometimes gives you more information than the vb
error message.
-john
sara wrote:
John -
InteractionKey in the table is the key to the table and is an
AutoNumber.
Dim lngInteractionKey As Long - is in the form
(frmUpdateInitialCall)
lngInteractionKey = DMax("InteractionKey", "tblInteractionHistory",
_
"ClientKey = " & lngClientKey & " AND InteractionTypeKey =
6") - is the statement executed to get the interaction key. (I am
looking for the "most recent" date in case the call comes in for a
former client, so it is an "initial" call (again).
So though I was quite sure the answers to your questions were both
"yes", above is the code/info to demonstrate all are long (unless I
misunderstand something)
Next?
Sara- Hide quoted text -
- Show quoted text -
I did it!!! Well, more accurately, you helped and Allen Browne
provided the final solution - let me explain.
I had another problem where an Update query wasn't working - never
connected the two problems. Allen was hjelping me with the other and
pointed me toward his site:
http://allenbrowne.com/ser-60.html
to learn a bit about dbExecute.
I applied the concept to my work problem, and somehow managed to
connect the concept to this db. It works! SO, now I do:
strSQL = "UPDATE tblInteractionHistory SET
tblInteractionHistory.Notes = """ & strPresProblem & """ " _
& " WHERE tblInteractionHistory.InteractionKey =" &
lngInteractionKey
Set db = DBEngine(0)(0)
db.Execute strSQL, dbFailOnError
MsgBox db.RecordsAffected & " record(s) updated."
Set db = Nothing
And it updates!! I am so excited, I can barely contain myself (next
stop, I'll go get a Life!).
Anyway, thanks so much for sticking this out with me! I hope this
makes sense to you as a solution as well. It works!
sara- Hide quoted text -

- Show quoted text -
Do you know where I can read about this "Execute" - "Set db"? The
only one I knew was docmd.runcommand.

Sara

Jul 24 '07 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PMB | last post by:
Thank you in advance for any and all assistance. I'm trying to input data from strings to a memo field. I would like to know how to check first to see if there is text there currently and if so...
3
by: BlackFireNova | last post by:
I am working on an Access 2002 Database. I created a new table and imported some notes data into it from an existing table. Now, when I try to create a List Box, and it displays the list of...
1
by: j.mandala | last post by:
I have a memo field in an appointment application that stores session notes for group psychotherapy sessions. Each attendee of the group has an appointment record. I want to be able to write a...
1
by: Steemer | last post by:
Okay, I checked with usual suspects and I'm still frustrated. ..txt file, fixed width. About 88 fields of varying length. All text fields. It will only let me add seperators to about the 410th...
2
by: David | last post by:
I have a table which is to hold 70 memo fields to contain notes on data changes to corresponding fields in a form. The problem is I dont want to have to create 70 forms to input notes into. Is it...
9
by: philip | last post by:
If I execute that : Dim Temp as string = "This is a text" Dim sw As StreamWriter Dim fullFileName as string = "c:\text.txt" sw = New StreamWriter(fullFilename) sw.Write(temp) sw.Close() ...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
11
tdw
by: tdw | last post by:
Hi all, I have tried a few different methods to accomplish this, but with no luck. I will post the code for the latest attempt at the end of this post. I work at a land surveying company. This...
1
by: jglabas | last post by:
I have a form with an unbound control called RevevantDateNotes. This is used to gather and update information stored on a table field of type Memo, with the same name (RevevantDateNotes). The...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.