Hello everyone 
I've got a simple problem. I want to switch my fields name into records. I already found a VBA code, I just do not know how to use it!
Ahhh, the newbies! ^^ "
It's probably not complicated when you understand VBA.
I think I need to create a module first... but then ?
http://stackoverflow.com/questions/8714353/converting-database-columns-into-associated-row-data

I've got a simple problem. I want to switch my fields name into records. I already found a VBA code, I just do not know how to use it!
Ahhh, the newbies! ^^ "
It's probably not complicated when you understand VBA.
I think I need to create a module first... but then ?
http://stackoverflow.com/questions/8714353/converting-database-columns-into-associated-row-data
Code:
Sub UnionSQL(ArrayColCommonWord As String, TableName As String)
Dim db As Database
Set db = CurrentDb
For Each fld In db.TableDefs(TableName).Fields
If Left(fld.Name, Len(ArrayColCommonWord)) <> ArrayColCommonWord Then
sSQL1 = sSQL1 & ",[" & fld.Name & "]"
End If
Next
sSQL1 = "SELECT " & Mid(sSQL1, 2)
For Each fld In db.TableDefs(TableName).Fields
If Left(fld.Name, Len(ArrayColCommonWord)) = ArrayColCommonWord Then
sSQL = sSQL & vbCrLf & "UNION ALL" & vbCrLf
sSQL = sSQL & sSQL1 & ",'" & fld.Name & "' As " & ArrayColCommonWord _
& ",[" & fld.Name & "] As " & ArrayColCommonWord & "Val"
sSQL = sSQL & vbCrLf & "FROM [" & TableName & "]"
End If
Next
Debug.Print Mid(sSQL, 14)
[COLOR="SeaGreen"]''This will fail if there is an existing query[/COLOR]
db.CreateQueryDef ArrayColCommonWord, Mid(sSQL, 14)
DoCmd.OpenQuery ArrayColCommonWord, acViewDesign
End Sub