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.

53481 questions
58
votes
9 answers

How to see the real SQL query in Python cursor.execute using pyodbc and MS-Access

I use the following code in Python (with pyodbc for a MS-Access base). cursor.execute("select a from tbl where b=? and c=?", (x, y)) It's Ok but, for maintenance purposes, I need to know the complete and exact SQL string send to the database. Is it…
philnext
  • 3,372
  • 4
  • 35
  • 57
54
votes
2 answers

VBA shorthand for x=x+1?

Sub btn1_Click() Static value As Integer value = value + 1 MsgBox value End Sub I swear when I was taking a VB.net course in college there was a shorter way to tell a variable to add '' to itself. Maybe x=+1. I am using Access now though instead of…
gregg
  • 852
  • 1
  • 9
  • 21
54
votes
2 answers

Difference between Microsoft.Jet.OleDb and Microsoft.Ace.OleDb

It has been a good number of years since I did some programming with Classic ASP and Microsoft Access where we used "Microsoft.Jet.Oledb" driver to access and display the data. I have been asked to do some work with accessing MS Excel data using…
RT88
  • 639
  • 2
  • 6
  • 9
53
votes
8 answers

How to connect R with Access database in 64-bit Window?

When I tried to connect R with Access database I get an error odbcConnectAccess is only usable with 32-bit Windows Does anyone has an idea how to solve this? library(RODBC) mdbConnect<-odbcConnectAccess("D:/SampleDB1/sampleDB1.mdb")
Chris
  • 1,128
  • 3
  • 11
  • 25
51
votes
8 answers

Writing large number of records (bulk insert) to Access in .NET/C#

What is the best way to perform bulk inserts into an MS Access database from .NET? Using ADO.NET, it is taking way over an hour to write out a large dataset. Note that my original post, before I "refactored" it, had both the question and answer in…
Marc Meketon
  • 2,213
  • 1
  • 21
  • 18
50
votes
2 answers

Multiple INNER JOIN SQL ACCESS

Syntax Error (missing Operator) in query expression 'tbl_employee.emp_id = tbl_netpay.emp_id INNER JOIN tbl_gross ON tbl_employee.emp_id = tbl_gross.emp_ID INNER JOIN tbl_tax ON tbl_employee.emp_id - tbl_tax.emp_ID'. SELECT…
emerjohn12
  • 535
  • 1
  • 5
  • 11
49
votes
6 answers

how to deal with .mdb access files with python

Can someone point me in the right direction on how to open a .mdb file in python? I normally like including some code to start off a discussion, but I don't know where to start. I work with mysql a fair bit with python. I was wondering if there is a…
Richard
  • 12,790
  • 29
  • 77
  • 108
49
votes
2 answers

Persist Security Info Property=true and Persist Security Info Property=false

For the properties: Persist Security Info=true and Persist Security Info=false Can you tell me what is the difference between them, and if I don't put it in my connection what will happen? connect.ConnectionString =…
Nourah
  • 521
  • 1
  • 4
  • 4
48
votes
2 answers

Why is "Yes" a value of -1 in MS Access database?

I'm looking at linked data in MS Access. The "Yes/No" fields contain the value -1 for YES and 0 for NO. Can someone explain why such a counter-intuitive value is used for "Yes"? (Obviously, it should be 1 and 0) I imagine there must be a good…
supermitch
  • 2,022
  • 4
  • 21
  • 26
46
votes
3 answers

What is the equivalent of Select Case in Access SQL?

I have a query which includes fields named openingbalance and commissions. I would like to compute values for commissions based on openingbalance, similar to this Select Case block in Access VBA: Select Case OpeningBalance Case 0 To 5000 …
Kelly K.
  • 477
  • 1
  • 5
  • 9
45
votes
13 answers

How to add default signature in Outlook

I am writing a VBA script in Access that creates and auto-populates a few dozen emails. It's been smooth coding so far, but I'm new to Outlook. After creating the mailitem object, how do I add the default signature to the email? This would be the…
PowerUser
  • 11,080
  • 18
  • 57
  • 92
45
votes
3 answers

Code to loop through all records in MS Access

I need a code to loop through all the records in a table so I can extract some data. In addition to this, is it also possible to loop through filtered records and, again, extract data? Thanks!
Ali
  • 593
  • 4
  • 7
  • 12
45
votes
12 answers

Best way to test a MS Access application?

With the code, forms and data inside the same database I am wondering what are the best practices to design a suite of tests for a Microsoft Access application (say for Access 2007). One of the main issues with testing forms is that only a few…
Renaud Bompuis
  • 15,947
  • 4
  • 51
  • 81
45
votes
11 answers

How to open a folder in Windows Explorer from VBA?

I want to click a button on my access form that opens a folder in Windows Explorer. Is there any way to do this in VBA?
VBwhatnow
  • 1,262
  • 1
  • 11
  • 22
44
votes
8 answers

Is there an equivalent to Thread.Sleep() in VBA

Is there an equivalent to Thread.Sleep() in Access VBA?
Johnno Nolan
  • 27,849
  • 17
  • 105
  • 158