update query with a memo field

G

Guest

I am trying to use an update query where use a form to select a record from a
table, and then by using a button, it runs an update query to update a memo
field in another table -- the fields CustomerRequestDescription and
CommonItemLongP are both memo fields. When I run the update query, I get an
invalid argument error if the fields are too long ... Listed below is the
update query...

UPDATE CustomerRequest SET CustomerRequest.CustomerRequestPrice =
[Forms]![Packages]![CommonItemPrice], CustomerRequest.LocationID =
[Forms]![Packages]![CommonItemLocationID],
CustomerRequest.CustomerRequestDescription =
[Forms]![Packages]![CommonItemLongP]
WHERE
(((CustomerRequest.CustomerRequestAutoID)=[Forms]![Packages]![CRAutoID]));

Thanks
Kevin
 
G

Gary Walter

Kevin Kraemer said:
I am trying to use an update query where use a form to select a record from
a
table, and then by using a button, it runs an update query to update a
memo
field in another table -- the fields CustomerRequestDescription and
CommonItemLongP are both memo fields. When I run the update query, I get
an
invalid argument error if the fields are too long ... Listed below is the
update query...

UPDATE CustomerRequest SET CustomerRequest.CustomerRequestPrice =
[Forms]![Packages]![CommonItemPrice], CustomerRequest.LocationID =
[Forms]![Packages]![CommonItemLocationID],
CustomerRequest.CustomerRequestDescription =
[Forms]![Packages]![CommonItemLongP]
WHERE
(((CustomerRequest.CustomerRequestAutoID)=[Forms]![Packages]![CRAutoID]));
Hi Kevin,

I assume this is happening off a click event of a command button
on the form?

You might try code in that event like:

Dim curPrice as Currency
Dim lngLocation as Long
Dim strDescr as String
Dim lngAutoID as Long
Dim strSQL as String

'if button not on form "Packages," then change "Me!" below
curPrice = Me!CommonItemPrice
lngLocation = Me!CommonItemLocationID
strDescr = Me!CommonItemLongP & ""
lngAutoID = Me!CRAutoID

strSQL = "UPDATE CustomerRequest " _
& "SET CustomerRequestPrice = " & curPrice _
& ", LocationID =" & lngLocation _
& ", CustomerRequestDescription = '" & strDescr & "' " _
& "WHERE CustomerRequestAutoID = " & lngAutoID & ";"
Debug.Print strSQL

CurrentDB.Execute strSQL, dbFailOnError

MsgBox "CustomerRequest successfully updated."


Access has a hard time guessing exact types of parameters.
My guess is that was what the problem was.

good luck,

gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top