Copy Field data A other Field (1 Viewer)

DaRTHY

Registered User.
Local time
Yesterday, 16:49
Joined
Mar 6, 2015
Messages
90
Hello Friends,

Firstly i was not sure which forum Topic should i use. If i did that wrong. Im sorry about that.

Question is : I have a Field-A and inside some data as usual. My data name is for example "Cow" and "Horse" but i wanna see them in Field-B "Animal", again by Field-A "Mark" and "John" will be in Field-B "Human"

How can i update it ?

With VBA or query or Macro any way is okey for me. Especially query ll be best. Because i ll use them on Chart but i need little bit less Criteria.

Ty for your helps
 
Last edited:

JHB

Have been here a while
Local time
Today, 01:49
Joined
Jun 17, 2012
Messages
7,732
The easiest way is in your query to use a UDF, where you have a Select Case or If structure to return the right value.
 

DaRTHY

Registered User.
Local time
Yesterday, 16:49
Joined
Mar 6, 2015
Messages
90
the way is looking easy, my favorite question is coming How :(
 
Last edited:

JHB

Have been here a while
Local time
Today, 01:49
Joined
Jun 17, 2012
Messages
7,732
the way is looking easy, my favorite question is coming How :(
What did you found when you search for a User Defined Function?
What did you not understand?

The query looks like below, remember to change the names to yours.
Code:
UPDATE TheFieldTable SET TheFieldTable.FieldB = FieldBValue([FieldA]);
The UDF - create a new module and paste the below into it.
Code:
Public Function FieldBValue(FieldValue As String) As String
  Select Case FieldValue
    Case "John", "Mark"
      FieldBValue = "Human"
    Case "Cow", "Horse"
      FieldBValue = "Animal"
  End Select
End Function
 

Users who are viewing this thread

Top Bottom