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
47
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
  • 613
  • 4
  • 8
  • 12
47
votes
2 answers

How to pass an array to a function in VBA?

I am trying to write a function that accepts an array as an argument. The array can have any number of elements. Function processArr(Arr() As Variant) As String Dim N As Variant dim finalStr as string For N = LBound(Arr) To…
user2395238
  • 850
  • 1
  • 9
  • 20
46
votes
10 answers

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

Is there an equivalent to Thread.Sleep() in Access VBA?
Johnno Nolan
  • 29,228
  • 19
  • 111
  • 160
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
  • 16,596
  • 4
  • 56
  • 86
45
votes
3 answers

Why is 1899-12-30 the zero date in Access / SQL Server instead of 12/31?

More out of curiosity than any real problem; the question came up today and I know I've seen 1899-12-30 used as a "default" date and a zero date in Access and older SQL Server apps. Just wondered why - where did that come from, and why isn't…
Peter Tirrell
  • 2,962
  • 4
  • 29
  • 52
45
votes
10 answers

How can I modify a saved Microsoft Access 2007 or 2010 Import Specification?

Does anyone know how to modify an existing import specification in Microsoft Access 2007 or 2010? In older versions there used to be an Advanced button presented during the import wizard that allowed you to select and edit an existing…
L G
45
votes
17 answers

Editing Record issues in Access / SQL (Write Conflict)

a problem has come up after a SQL DB I used was migrated to a new server. Now when trying to edit a record in Access (form or table), it says: WRITE CONFLICT: This record has been changed by another user since you started editing it... Are there…
aSystemOverload
  • 2,994
  • 18
  • 49
  • 73
44
votes
3 answers

How to create a new column in a select query

In MS Access, I want to insert a new column into the returned result of a select query. The new column has the same value for every row. For example, my select returns columns A, B and I want C to be the new column created by the select query: A B…
Martin08
  • 20,990
  • 22
  • 84
  • 93
43
votes
4 answers

Access VBA | How to replace parts of a string with another string

I am trying to create a piece of code that replaces one word with another. Example: Replace Avenue with Ave and North with N. I am using MS Access, I could use SQL REPLACE Function but I want to do this in VBA using Access module so that I can…
Asynchronous
  • 3,917
  • 19
  • 62
  • 96
43
votes
5 answers

Is it possible to pass parameters programmatically in a Microsoft Access update query?

I have a query that's rather large, joining over a dozen tables, and I want to pull back records based on an id field (e.g.: between nStartID and nEndID). I created two parameters and tested them as criteria and they work fine. The issue is, I need…
Jav
  • 543
  • 1
  • 4
  • 10
42
votes
7 answers

Using left join and inner join in the same query

Below is my query using a left join that works as expected. What I want to do is add another table filter this query ever further but having trouble doing so. I will call this new table table_3 and want to add where table_3.rwykey =…
Will
  • 1,084
  • 5
  • 20
  • 42
42
votes
6 answers

How to copy to clipboard using Access/VBA?

Using VBA inside Access2003/2007. How to copy the contents of a string variable to the clipboard? This site recommends a creating a zero length TextBox, copying the string to the TextBox, then running DoCmd.RunCommand acCmdCopy. Ugh. I mean, we may…
hawbsl
  • 15,313
  • 25
  • 73
  • 114
42
votes
8 answers

Error: "Could Not Find Installable ISAM"

I've written some VBA code in an Excel workbook to retrieve data from an Access database in the same directory on a desktop. It works fine on my machine and several other machines running Windows XP, but when we tested this on a Vista machine, we…
cLFlaVA
  • 1,468
  • 3
  • 13
  • 17
42
votes
9 answers

Find the directory part (minus the filename) of a full path in access 97

For various reasons, I'm stuck in Access 97 and need to get only the path part of a full pathname. For example, the name c:\whatever dir\another dir\stuff.mdb should become c:\whatever dir\another dir\ This site has some suggestions on how to do…
apenwarr
  • 10,838
  • 6
  • 47
  • 58
41
votes
5 answers

Autonumber value of last inserted row - MS Access / VBA

I have a JET table with an auto-number as the primary key, and I would like to know how I can retrieve this number after inserting a row. I have thought of using MAX() to retrieve the row with the highest value, but am not sure how reliable this…
a_m0d
  • 12,034
  • 15
  • 57
  • 79