Link to home
Start Free TrialLog in
Avatar of hudmon
hudmon

asked on

How do you upadate a field in an Access table?

I have a Access table with two fields.  Field 1 is named activity code, Field two is named procedure code.  Data in field one is in the format of 90801h, 90802h, 90803h.  Data in Field 2 is in the format of Z123, Z124, Z125.  In this example, 90801h is = to Z123, 90802h = Z124, & 90803h = Z125. However the 90801 #'s have no relevance as to what I am trying to accomplish in the end

I want to make an Update query that will read the values in Field2 (the Z Numbers) and replace the H numbers with another value that is also equal and relevant to me.  For instance:  I would like for the query to read Z123 in field2 and then replace 90801h with 1420.  

I am trying to write an expression in my Update query that goes something like this:

If field2 is = to Z123 then Field1 is = to 1520 and If field2 is = to Z124 then Field 1 = 1530 and so on.  What is the correct syntax to do this?
Avatar of infolurk
infolurk

Hi Hudmon.
You will need to run mulpiple update queries, each one updating one field for one criteria. Otherwise you can create a function using vb to loop through your recordset and update the field based on your if criteria.
I dont think you will be able to create your if expression in an update query.

HTH
SFH
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial