|
-
Aug 21st, 2000, 03:56 AM
#1
Thread Starter
Hyperactive Member
Hi;
I was wondering how can one retreive Field name in a db (column name) (access or Sql) .
In clearer terms , suppose you have a DB with one or more tables... we are only interested in "TableX" ... which has
Z number of fields. I want to be able to retrieve those fields name
trough VB code ... thus having a progam that does the following :
- user provides table name and dB name
- Program returns :
" this table contains Z Fields "
" here are the fields names "
"field1"
"field2"
.... etc
any help would be greatly apreciated
-
Aug 21st, 2000, 05:57 AM
#2
Lively Member
1.) open a recordset(rs) that contain all fields of your table
2.) gives you the number of fields
3.) to get the fieldname use this:
Code:
For i = 0 To rs.Fields.Count - 1
Debug.Print rs.Fields(i).Name
Next i
hope this helps
[Edited by Nina on 08-21-2000 at 07:29 AM]
-
Aug 21st, 2000, 06:12 AM
#3
Thread Starter
Hyperactive Member
Yes But
... I c .. but will that return to me the Value contained in this field of that record ... or The NAME of the Field in the TABLE ?? that is what I need ...
I need the Name Of the Field the Column name that is ...
-
Aug 21st, 2000, 06:31 AM
#4
Lively Member
sorry, forgot to add the .name property...
now it will give you name of the field
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|