Get column names

前端 未结 2 1424
终归单人心
终归单人心 2020-12-05 15:52

I need to get all of the column names of a table using VBA or Access SQL and iterate through them for validation, does anyone have a solution to this, I have searched Google

2条回答
  •  爱一瞬间的悲伤
    2020-12-05 16:02

    This will work

    Set db = CurrentDb()
    Set rs1 = db.OpenRecordset("Table1")
    Dim fld As DAO.Field
    For Each fld In rs1.Fields
        MsgBox (fld.Name)
    Next
    Set fld = Nothing
    

提交回复
热议问题