Anyone has tried this?
I have a table like below:
I want to create a query to rearrange the field like below:
I managed to do that using below function. "ChooseLike" is 1 for No1, 2 for No2 and so on.
...................................................................................................
Option Compare Database
Option Explicit
Public Sel1, Sel2, Sel3, Sel4, Sel5, Sel6, Para1, Para2, Para3, Para4, Para5, Para6 As String
Public ChooseLike As Variant
Function SelectFrom(ChooseLike, Sel1, Sel2, Sel3, Sel4, Sel5, Sel6, Para1, Para2, Para3, Para4, Para5, Para6) As String
If Sel1 = ChooseLike Then
SelectFrom = Para1
ElseIf Sel2 = ChooseLike Then
SelectFrom = Para2
ElseIf Sel3 = ChooseLike Then
SelectFrom = Para3
ElseIf Sel4 = ChooseLike Then
SelectFrom = Para4
ElseIf Sel5 = ChooseLike Then
SelectFrom = Para5
ElseIf Sel6 = ChooseLike Then
SelectFrom = Para6
End If
End Function
..................................................................................................
Does Ms Access has similar function like this?
I have a table like below:
I want to create a query to rearrange the field like below:
I managed to do that using below function. "ChooseLike" is 1 for No1, 2 for No2 and so on.
...................................................................................................
Option Compare Database
Option Explicit
Public Sel1, Sel2, Sel3, Sel4, Sel5, Sel6, Para1, Para2, Para3, Para4, Para5, Para6 As String
Public ChooseLike As Variant
Function SelectFrom(ChooseLike, Sel1, Sel2, Sel3, Sel4, Sel5, Sel6, Para1, Para2, Para3, Para4, Para5, Para6) As String
If Sel1 = ChooseLike Then
SelectFrom = Para1
ElseIf Sel2 = ChooseLike Then
SelectFrom = Para2
ElseIf Sel3 = ChooseLike Then
SelectFrom = Para3
ElseIf Sel4 = ChooseLike Then
SelectFrom = Para4
ElseIf Sel5 = ChooseLike Then
SelectFrom = Para5
ElseIf Sel6 = ChooseLike Then
SelectFrom = Para6
End If
End Function
..................................................................................................
Does Ms Access has similar function like this?