Append info to an existing field based on the value of another field

0

I would like to run a query that updates a field's value with whatever is already there but with an "cbt" appended in the end.

For example say there's a field called Currency and for a certain record Currency is "USDCNY", I want the field Details to be updated to whatever is in the field plus "cbt" at the end.

Ideally I would like to add this to the query in the Criteria line of a field called Details. I have tried something like this in the Criteria line of the field called Details. But it isn't working.

IIf([Currency]="USDCNY",Update[DETAILS],+'cbt')

Melissa

Posted 2015-02-05T21:05:48.867

Reputation: 1

Answers

0

Try using "Select..." vs Select... VBA seems to like quotations before and at the end of the select statements. For example this:

sql = "SELECT * FROM [tbl_Approval] WHERE [Approver]= " & "'" & Me.Disp & "'"

Instead of this:

sql = SELECT * FROM [tbl_Approval] WHERE [Approver]=  & "'" & Me.Disp & "'"

Jeremy

Posted 2015-02-05T21:05:48.867

Reputation: 1

Where is the update? – yass – 2017-06-09T20:32:31.683

0

UPDATE [Table1] Set Details = Details & "cbt" WHERE Currency = "USDCNY"

This is a update query that you can create from the query design. For info of the structure of an update query, visit www.w3schools.com

wbeard52

Posted 2015-02-05T21:05:48.867

Reputation: 3 149

Thank you for your help. When I enter this into the Access builder, it keeps getting hungup on the command operand "where" or "set" or "update" These command do not appear to be in the list of Access Functions. Are they a special Add in? The error I get is "you may have entered an operand without an operator". Any ideas would be great. – Melissa – 2015-02-09T22:15:13.057

You don't want the access query wizard. It doesn't have the capability of what you need. Create a new query design. Close out the table window. Right click anywhere and select SQL View. Paste the query above into the new view. Update [Table1] with the name of your table. – wbeard52 – 2015-02-11T23:40:42.437