find out field names (with out access)

RSXchin

Well-known Member
Joined
Oct 23, 2010
Messages
758
I know this sounds silly, but I have a database that is too large to be opened with excel and I don't have access installed, because my boss doesn't want me to use it (I don't know).

I can use sql queries, but I DON'T know the field names in the table. How can I do a query that will return ALL field names in table "HistoryTable"?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Code:
SELECT * FROM HistoryTable;
IF that's too many records try:

Code:
SELECT TOP 5 * FROM HistoryTable;

That will return records - normally with field names. If that doesn't work talk to your IT Dept.
 
Upvote 0
I Belive you want to fetch the name of Table fields in Excel so that you can refer in your queries written in VBA Code:

Use below code: Fill the full Path of your DB with DB Name and extension

and Table Name in Code:

Rich (BB code):
Sub FindFieldNames()
Dim rstRecordset    As Object
Dim adoConn         As Object
Dim strQuery        As String
Dim i                   as Long
    Set adoConn = CreateObject("AdoDB.Connection")
    Set rstRecordset = CreateObject("AdoDB.Recordset")
    adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=""  enTer full DBPath with DBName.mdb "";"
 
    strQuery = "Select * from TableName"
 
    rstRecordset.Open strQuery, adoConn, 3, 3
 
    For i = 0 To rstRecordset.fields.Count - 1
        rstRecordset.movefirst
        Cells(1, i + 1) = rstRecordset.fields(i).Name
    Next
End Sub
 
Upvote 0
See, I knew we'd see eachother more. Glad we met Littleiitin!!! Thank you Xenou, I'll try that when I get back to work. I'm starting to see how access can be better than excel ( but I know sooooo much more excel vba :( )
 
Upvote 0
How was an Access file/database created originally and is being added to if you don't have Access?
 
Upvote 0
It is being created by an enterprise database program called "Millenium Expert"

The filetype is ".mdb"
 
Upvote 0
That would be 'Millenium Expert' with it's 'ODBC compliant database with easy data export
and import'?
 
Upvote 0
It is great if I'm looking at data that doesn't change much. But new records are being created every 5 seconds or so.

1. I can't make the kinds of queries I want, in the program itself
2. By the time I get the report created and formatted, it is too old.
3. I'd prefer to have a query that I can refresh.
4. You don't understand how horribly bad the UI is.

The database is used to record when people badge in/out. The query I ultimately want to make is, I want it to tell me who is still here.

None of the prewritten queries give me that kind of info. What I've been doing, is returning all history from today, reverse sorting, removing duplicates (that way only the latest instance survives), and removing the rows that are badge outs.


I'm really bad at explaining things.



The End
 
Upvote 0
Use my Code to find out the Table Fields Name.

In that you can find out where In and aout time is entered.

Then use
Select Names from TableName where Intime is not null and OutTime is null
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,472
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top