In Oracle/SQL Server you can say something like:
Select column_name from sysobjects where table_name = 'order'
How do I do that in MS Access?
The MSysObjects doesn't seem to help much.
I should have said " table field names". My bad.SELECT MSysObjects.Name, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Type)=1));
Doesn't help much with what exactly. What are you trying to do? And what error are you getting?
I should have said " table field names". My bad.
So i want to see a list of my order table's field names
Order_no
Order_description
Order_date
etc
So the sql statement should be something like:
Select filed_name from MSysColumns where table_name = 'Order'
I tried that and it gave me this error:try
select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = my_table_name
Could not find file "C:\Documents and settings\heitahola\my documents\INFORMATION_SCHEMA.mdb
I tried that and it gave me this error:
LOL. When a programmer can't seem to find a solution, they always say why use MS Access. I wish I could use another database. Haven't used MS Access in a long time.Erf... why do you need to use MS Access anyway?
Otherwise I'd recommend several other stand-alone (not server based) databases you could use that acts more like MS SQL and MySQL than MS Access will ever do... without the need for propriety software or servers.
linkDim oleConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & myDB & ";User Id=admin;Password=;")
oleConn.Open()
Dim schemaTable As DataTable
Dim i As Integer
schemaTable = oleConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, _
New Object() {Nothing, Nothing, "order", Nothing})
For i = 0 To schemaTable.Columns.Count - 1
Debug.Print(schemaTable.Rows(i)!COLUMN_NAME.ToString)
Next i
oleConn.Close()
LOL. When a programmer can't seem to find a solution, they always say why use MS Access. I wish I could use another database. Haven't used MS Access in a long time.
I just wanted to know if there is a simple sql statement to do that, without using other programs. I guess it's not possible with MS Access query. Maybe Access 07 has this ability.
Edit: I managed to get it, though I didn't want to do it through the code.
link