473,702 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ


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?!?!

Nov 12 '05 #1
2 4017
"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?!?!


Assuming a modern version of Access:

Sub GetColumnNames( )
Dim r As ADODB.Recordset
Dim Table As String
Set r = CurrentProject. Connection.Open Schema(adSchema Columns)
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
End With
End Sub

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

(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
"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?!?!


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

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

For i = 0 To db.TableDefs.Co unt - 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

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 Type = Value List. Row Source = "1; "Above"; 2; "Below"; 3; "Equal"". When I try to SELECT <field> FROM <table> in my C++ application through ADO, I get numeric value of the field. How can I get string representation of this numeric value from the...
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 the data is showing up in the right places in reports and everything is working fine. However the field no longer appears in either the design view or the datasheet view of the table. If I open the forms and reports that already include the field...
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 make a query that selects from a table as desribed below .. I have a table (Volunteer) that has a member field (memnumber) and a number of fields that are headed in various categories and are yes/no formated
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 names. My goal is to have one long list of all the names, not A next to B like one gets when you use the & operator. The eventual goal is to be able to print labels of all the individuals. I have no problem creating a label-Report from the Query....
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 assistance. I say additional because I've already had help which is greatly appreciated. I do try to take the time and understand the provided script in hopes on not having to trouble others on those. But here it goes...
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 I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the 'Display Control' property. Thanks to Allen Browne for some ideals per...
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 mostly handling let say 5 companies. Every time I have to navigate or choose the find record button to get the right company. I am looking fo a feature to have listed in a combo list the last 5 visited records ("recently visited records").
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 selected table in ListBox1. The ListBox2 will list the selected field name by user. It will display in list box with this format "tablename.fieldname". So far i have done until this. Now i am wondering whether can create SQL statement for each table in...
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 then have these applied to a query as the field headings so that the flow data can be outputted for only the specified time periods. I.e. The user would select one or more time periods from the list box (e.g. 24 Hour flow, 18 Hour flow and 12 Hour...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.