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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restructuring Data 1

Status
Not open for further replies.

carlosfandango

Technical User
Feb 27, 2004
1
GB
I have a number of tables each with the same 10 unique ID's in. In each table there are numerous figures about each record, the fields have the naming convention "Code _ Timeframe" for example SSX32_0304 for the item of data SSX in 2003/04.

The problem is I need to append all the data in all the columns into one. So I have a huge list containing the unique ID then the column name then the data item.

Is this at all possible easily as opposed to listing all of the fields in a union query as there is hundreds?

Cheers
Carl
 
Look into the "UNION Operation" in VB Help. If that doesn't work for you, I'd probably try something like this:
Code:
Function ListFields(ByVal strTabName As String) As String

Dim dbs As DAO.Database
Dim TDef As DAO.TableDef
Dim MyField As DAO.Field
Dim strList As String

Set dbs = CurrentDb
Set TDef = dbs.TableDefs(strTabName)

For Each MyField In TDef.Fields
    strList = strList & vbCrLf & MyField.Name
Next MyField


ListFields = strList

End Function

to get at least the field names.


TomCologne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top