Question data transform

sandy70

Registered User.
Local time
Today, 12:59
Joined
Apr 16, 2008
Messages
41
hi guys

anyone know how to transform this data
aaa02.jpg


to this ??

aaa03.jpg


any idea how to make it ???
 
To create the second table from the first requires 7 append queries. One for each of the code columns. If there are more columns in the table that we are not seeing, they will also need their own append queries. With only 7 columns, I would just create 7 queries. If you're talking dozens or more, I might consider creating and running the append queries in code.
 
The code solution isn't that bad. Use the fields collection of the tabledef to get the column names.
 
If I had had a code solution already built, I would have posted it. Create a loop that reads through the fields of the tabledef. You'll need to ignore fields that don't start with "Code". Then build an SQL string like the following and run it using DoCmd.RunSQL.

SQL = "Insert Into ( MyDate, Phone, CodeName, PackName) Select [Date], [Phone], CustID, " & strFieldName & ", " & strValue ", From YourTable;"
 

Users who are viewing this thread

Back
Top Bottom