SQL Server field names VBA

I have a SQL server 2008 database with a table called Invoices.

Using Access 2007 VBA code, how do I get all the field names from the table Invoices.
Who is Participating?
IrogSintaConnect With a Mentor Commented:
Here's some code you could play with:
    Dim rs As Recordset
    Dim fld As Field
    Set rs = CurrentDb.OpenRecordset("Select * From TABLENAME Where FALSE")
    For Each fld In rs.Fields
        Debug.Print fld.Name
    Set rs = Nothing

Open in new window

Computer EggheadCommented:
Link your SQL Server table into your Access database, and create a module that you can run with the code shown here:  TableInfo() function
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if you can already query the table (ADODB), you simply can run this query
SELECT * FROM Invoices WHERE 1 = 0

Open in new window

, and loop on the recordset's FIELDS collection.
IdaracAuthor Commented:
Works great ode was pretty close. Just had to play with it a bit
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.