Question data transform (1 Viewer)

sandy70

Registered User.
Local time
Today, 04:17
Joined
Apr 16, 2008
Messages
36
hi guys

anyone know how to transform this data


to this ??



any idea how to make it ???
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Feb 19, 2002
Messages
42,981
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.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Feb 19, 2002
Messages
42,981
The code solution isn't that bad. Use the fields collection of the tabledef to get the column names.
 

sandy70

Registered User.
Local time
Today, 04:17
Joined
Apr 16, 2008
Messages
36
The code solution isn't that bad. Use the fields collection of the tabledef to get the column names.

can u give more detail about it ??? or may be some example

still confuse about is
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:17
Joined
Feb 19, 2002
Messages
42,981
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

Top Bottom