• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

Access - Convert Column Names in one Table into Rows in another table

How can I get the column NAMES from one table and insert them as a record for each in another table

This is Access 2003

Thanks
Keith
0
keschuster
Asked:
keschuster
1 Solution
 
Rey Obrero (Capricorn1)Commented:

sub getColumn()
dim rs1 as dao.recordset, rs2 as dao.recordset, j as integer

set rs1=currentdb.openrecordset("Table1")
set rs2=currentdb.openrecordset("Table2")

for j=0 to rs1.Fields.count-1
      rs2.addnew
      rs2![FieldName]=rs1.fields(j).name
      rs2.update
 next

rs1.close
rs2.close
set rs1=nothing
set rs2=nothing
end sub
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now