Questions tagged [ms-access]

Microsoft Access, also known as Microsoft Office Access, is an application development and database development tool from Microsoft. It combines the Microsoft Jet/ACE Database Engine with a graphical user interface and software-development tools. Other database engines, such as SQL Server, can also be used as a database server for Access applications.

Microsoft Access, also known as Microsoft Office Access, is an application development and database development tool.

It commonly uses the Jet or ACE database engine, but is not limited to these.

It is a member of the suite of applications, included in the Professional and higher editions or sold separately. The current version is Microsoft Access 2016.
Applications built with Microsoft Access can be distributed to end users with a free run-time version of the application that lets them view databases without needing the full installation of Access.

This tag is version-agnostic. If you have a question about using a specific version, please tag your question appropriately so others know what version you are using. Ex:

and or if your question involves VBA.

Links

Common errors

Reserved Words

One of the most common problems with MS Access SQL is the use of a reserved word in a query or SQL string. It is often suggested that these words are bracketed, [RESERVED WORD], as is required for field (column) names containing spaces or special characters. But rather than trying to figure out what is and is not a reserved word and bracketing only those, using the convention of prefixing all field names with the table name — or better yet, the alias — will prevent this problem from occurring. This will save problems in other cases, not just reserved words. For example:

 SELECT a.id, b.id, b.name 
 FROM tablea a
 INNER JOIN tableb b 

It also makes the SQL compatible with other databases.

Connection Strings

The usual connection string for MS Access *.accdb files, that is, files created in Access 2007 format, is:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;

The ACE connection string is backwards-compatible and will open *.mdb files; however, for *.mdb files, you can also use:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myFolder\myAccess.mdb;

Jet is often installed by default on Windows systems, but ACE is not. ACE is available in both 32-bit and 64-bit.

57313 questions
40
votes
8 answers

What are the rules governing usage of parenthesis in VBA function calls?

I've just had an irritating 30 minutes on a "compiler error" in VBA (Access 2003) caused by my use of parenthesis around the arguments I'm passing to a Sub I defined. I've been searching to find a decent article/tutorial/instruction as to when…
HorusKol
  • 8,375
  • 10
  • 51
  • 92
40
votes
12 answers

Get Name of Current VBA Function

For error handling code, I would like to get the name of the current VBA function (or sub) that the error occurred in. Does anyone know how this could be done? [EDIT] Thanks all, I had hoped that an undocumented trick existed to self-determine the…
maxhugen
  • 1,870
  • 4
  • 22
  • 44
40
votes
6 answers

How does one decompile and recompile a database application?

I have an Access database application and I would like to know the proper way of decompiling and recompiling it.
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
39
votes
8 answers

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

Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database. Is there an equivalent I can use?
luntain
  • 4,560
  • 6
  • 37
  • 48
39
votes
6 answers

How do I execute multiple SQL Statements in Access' Query Editor?

I have a text file with a few SQL statements in it that I want to run on an Access database. I thought that should be possible with Access' Query Editor. So, I go into this editor and paste the statements: insert into aFewYears (yr) values…
René Nyffenegger
  • 39,402
  • 33
  • 158
  • 293
38
votes
2 answers

How to check for Is Not Null in VBA?

Hi I have the following expression. I'm trying to say "if the second field Is Not Null". Can you help. Thanks =Iif((Fields!approved.Value = "N" & Fields!W_O_Count.Value IsNotNull), "Red", "Transparent")
giles
  • 823
  • 3
  • 12
  • 25
38
votes
4 answers

Comparison of Dictionary, Collections and Arrays

I am trying to work out the relative benefits and features of dictionaries compared with collections and arrays. I found an excellent article here but can't find a simple table that compares all the various features. Does anyone know of one?
HarveyFrench
  • 4,440
  • 4
  • 20
  • 36
38
votes
6 answers

Query Microsoft Access MDB Database using LINQ and C#

I have a *.MDB database file, and I am wondering if it is possible or recommended to work against it using LINQ in C#. I am also wondering what some simple examples would look like. I don't know a lot about LINQ, but my requirements for this task…
Matthew Ruston
  • 4,282
  • 7
  • 38
  • 47
38
votes
8 answers

coalesce alternative in Access SQL

In T-SQL, you can do this: SELECT ProductId, COALESCE(Price, 0) FROM Products How do you do the same thing in Access SQL? I see examples for doing it with Nz in VBA, but I'm looking for the SQL equivalent. Thanks.
Nathan DeWitt
  • 6,511
  • 8
  • 46
  • 66
38
votes
13 answers

"Operation must use an updateable query" error in MS Access

I am getting an error message: "Operation must use an updateable query" when I try to run my SQL. From my understanding, this happens when joins are used in update/delete queries in MS Access. However, I'm a little confused because I have another…
Andrew Martin
  • 5,619
  • 10
  • 54
  • 92
37
votes
11 answers

MS Access (MDB) concurrency

For a small project I need to utilize a simple database with very light requirements: few tables, no more than few thousands of records in total, 2 or 3 users. I am working in .NET environment. As a database server (even those Express editions)…
petr k.
  • 8,040
  • 7
  • 41
  • 52
37
votes
3 answers

Does VBA contain a comment block syntax?

In VBA is there a short way to comment out a block of code the same way java uses /*...*/?
Tim.DeVries
  • 791
  • 2
  • 6
  • 21
37
votes
5 answers

Show "Open File" Dialog

How would I go about showing an open file (or file select) dialog in access 2007 VBA? I have tried using Application.GetOpenFileName as I would in Excel, but this function doesn't exist in Access.
jwoolard
  • 6,024
  • 9
  • 37
  • 37
36
votes
12 answers

What do I need to read Microsoft Access databases using Python?

How can I access Microsoft Access databases in Python? With SQL? I'd prefere a solution that works with Linux, but I could also settle for Windows. I only require read access.
Georg Schölly
  • 124,188
  • 49
  • 220
  • 267
36
votes
3 answers

Case expressions in Access

Can you use case expressions in Access? I'm trying to determine the max date form 2 columns but keep getting syntax errors in the following code: CASE WHEN dbo_tbl_property.LASTSERVICEDATE > Contour_dates.[Last CP12 Date] THEN…
elphj