Something so simple yet I am just not getting it!!!
I want to pull the field names from my table ,tblQ17, and list them in a single column table I have ready, called Allfields. (Field name is NameOfField)
Code is ...
Sub TestThis()
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("tblQ17")
For Each fld In rst.Fields
MsgBox fld.Name
fredde = fld.Name
'....works ok so far...
' This line works OK to put a fixed value into the table....
DoCmd.RunSQL "INSERT INTO Allfields (NameOfField) SELECT 'sssss'"
'' but i want to do this...
DoCmd.RunSQL "INSERT INTO Allfields (NameOfField) .*******. (meaning to be Now put the field name found above into the table Allfield in column NameOfField)
Next fld
rst.Close
Set rst = Nothing
Set fld = Nothing
End Sub
Simple? Yeah?
Please help.
I want to pull the field names from my table ,tblQ17, and list them in a single column table I have ready, called Allfields. (Field name is NameOfField)
Code is ...
Sub TestThis()
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("tblQ17")
For Each fld In rst.Fields
MsgBox fld.Name
fredde = fld.Name
'....works ok so far...
' This line works OK to put a fixed value into the table....
DoCmd.RunSQL "INSERT INTO Allfields (NameOfField) SELECT 'sssss'"
'' but i want to do this...
DoCmd.RunSQL "INSERT INTO Allfields (NameOfField) .*******. (meaning to be Now put the field name found above into the table Allfield in column NameOfField)
Next fld
rst.Close
Set rst = Nothing
Set fld = Nothing
End Sub
Simple? Yeah?
Please help.