Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

revert row to column ploblem

Status
Not open for further replies.

thawatwong

Instructor
Aug 25, 2002
38
HK
Hi,I want to revert data in my table from row
to column.Could somebody help?.By using
Access97 or Excel97. Thank,
 
By "revert row to column", I assume you mean "transpose". This operation does not make sense from a physical point of view in Access, where columns represent fixed field definitions in a table, and rows represent record instances. However, you might want to read up about crosstab queries in Access online help. This capability does allow you to effectively invert row data values to become tabular data.

In excel, you can reverse row and column data by selecting a range of cells, click the copy option, select the upper left of the paster area, and selecting the edit, paste special options and selecting the transpose check box.

Hope this is what you are looking for
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
If Steve's solutions don't meet your requirements, here is another possibility. Requires VBA coding.

If you read the table with an ADO recordset, you can use the GetRows method which returns the recordset(table in your case) as a 2 dimension array. The first dimension is columns and the second is rows (columns and rows inverted from the recordset).

In vba code set up a loop to copy array values to Access Table with inverted format. Of course, this is only good for an instance in time since more rows could be added to the original table at any time. You would need to dynamically build the column names in the table from the record count on the ADO recordset, but it is doable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top