How to select top 10 in Access query?

select top 10 Name, Price from MyTable order by Price desc Updated: @Fionnuala pointed out that: “Access SQL selects matches, so it will select all items with the same highest prices, even if this includes more than 10 records. The work-around is to order by price and a unique field (column).” So, if you have … Read more

How do you comment an MS-access Query?

I decided to add a condition to the Where Clause that always evaluates true but allows the coder to find your comment. Select … From … Where …. And “Comment: FYI, Access doesn’t support normal comments!”<>”” The last line always evaluates to true so it doesn’t affect the data returned but allows you to leave … Read more

What will we do after Access? [closed]

Access is not a DBMS. Or at least it’s not just a simple DBMS. It’s a very good RAD environment, a simple way to create SQL code graphically, and a regular front-end to fully fledged DBMs. Neither SQL Server (Express or MSDE) nor Oracle, MySQL, etc. will ever replace it, until they come integrated with … Read more

How can I get table names from an MS Access Database?

To build on Ilya’s answer try the following query: SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE (((Left([Name],1))<>”~”) AND ((Left([Name],4))<>”MSys”) AND ((MSysObjects.Type) In (1,4,6))) order by MSysObjects.Name (this one works without modification with an MDB) ACCDB users may need to do something like this SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE (((Left([Name],1))<>”~”) AND ((Left([Name],4))<>”MSys”) AND ((MSysObjects.Type) … Read more

Get Name of Current VBA Function

There’s nothing to get the current function name, but you can build a fairly lightweight tracing system using the fact that VBA object lifetimes are deterministic. For example, you can have a class called ‘Tracer’ with this code: Private proc_ As String Public Sub init(proc As String) proc_ = proc End Sub Private Sub Class_Terminate() … Read more