[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

SQL Server field names VBA

Posted on 2014-02-09
4
Medium Priority
?
639 Views
Last Modified: 2014-02-09
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.
0
Comment
Question by:Idarac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:Computer Egghead
ID: 39845937
Link your SQL Server table into your Access database, and create a module that you can run with the code shown here:  TableInfo() function
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39845953
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.
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 39845981
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
    Next
    rs.Close
    Set rs = Nothing

Open in new window

Ron
0
 
LVL 1

Author Closing Comment

by:Idarac
ID: 39846193
Works great ode was pretty close. Just had to play with it a bit
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question