473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

GENERATE FIELD LIST FROM A QUERY?

QUESTION for the experts out there :)

Is it possible to write a query that would list the datafields by each table
in a database? How would I do that?!?!

TIA
Joe
Nov 12 '05 #1
2 3972
"Joe User" <jo*@user.com> wrote in news:bs**********@tribune.mayo.edu:
QUESTION for the experts out there :)

Is it possible to write a query that would list the datafields by each
table in a database? How would I do that?!?!

TIA
Joe


Assuming a modern version of Access:

Sub GetColumnNames()
Dim r As ADODB.Recordset
Dim Table As String
Set r = CurrentProject.Connection.OpenSchema(adSchemaColum ns)
With r
Do While Not .EOF
If .Fields("TABLE_NAME") <> Table Then
Debug.Print .Fields("TABLE_NAME").Value
End If
Debug.Print , .Fields("COLUMN_NAME").Value
Table = .Fields("TABLE_NAME").Value
.MoveNext
Loop
End With
End Sub

This gives the columns of queries too. You will have to do some filtering
to get just your tables.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
DFS
"Joe User" <jo*@user.com> wrote in message
news:bs**********@tribune.mayo.edu...
QUESTION for the experts out there :)

Is it possible to write a query that would list the datafields by each table in a database? How would I do that?!?!

TIA
Joe

Don't know about a query, but this code will give you a list of tables and
fields

dim i,j
dim db as database
set db = currentdb()

For i = 0 To db.TableDefs.Count - 1
For j = 0 To db.TableDefs(i).Fields.Count - 1
MsgBox "Table: " & db.TableDefs(i).Name & " Field:" &
db.TableDefs(i).Fields(j).Name
Next j
Next i


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
1
by: Jonathan | last post by:
I have belatedly discovered an odd problem. I created a new memo field called "IntellectualAccessNotes" in a replicated table . I put it into a form and people have been entering data into it and...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
4
by: justin tyme | last post by:
Hello Experts! I would like to combine (which may not be the correct technical term) two text fields from the same table in a query. Specifically, text field A and text field B are both lists of...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
2
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
3
by: sql2020 | last post by:
hi, i am fresh grad and wondering whether this idea can be done.. i have 1 ComboBox and 2 ListBox. ComboBox contain list of table, when user select a table, it will list the field name for...
2
by: mfletcher | last post by:
Hi I am constructing an Access Database to produce traffic flow information to validate a traffic model. I want to have the functionality to select time periods from a list box on a form and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.