Access does have a Select Case ... End Select statement. In the
circumstance you describe, however, you may only need an Update Query to do
your data cleanup. For example:
- Open a new query and select the table containing the field/fields to be
updated.
- Right click in the upper portion of the query's design and click Query
Type from the popup menu.
- Select Update Query
- In the first empty column in the lower portion of the query's design view,
enter the following in each row:
Field: row - C_TYPE
Update to: row - "MNB"
Criteria: row - "MNC"
Should your needs involve analyzing the field for numerous different values,
you could create a function in a public module which could be called by your
update query. Something like the following:
Public Function UpdateC_TYPE (strCtype as string) as String
Select Case strCtype
Case "MNC"
UpdateC_TYPE = "MNB"
Case "XYZ"
UpdateC_TYPE = "ABC"
Case Else
UpdateC_TYPE = "MNB"
End Select
End Function
You would then use this function in your Update Query in the Update to: row
as follows:
UpdateC_TYPE([C_TYPE])
hth,
--
Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX
Rowan said:
Does Access have a function similar to Case in DB2 or Oracle? What I am
trying to do is clean up some data which has been entered as either "MNB" or
"MNC" where it should only read "MNB". So in DB2 my query would read: