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
36
votes
6 answers

SQL to Query text in access with an apostrophe in it

I am trying to query a name (Daniel O'Neal) in column names tblStudents in an Access database, however Access reports a syntax error with the statement: Select * from tblStudents where name like 'Daniel O'Neal' due to the apostrophe in the…
Kevin
  • 447
  • 2
  • 5
  • 7
36
votes
5 answers

java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occurring. Why?

I have created an MS Access database and assigned a DSN to it. I want to access it through my Java application. This is what I am doing: public class AccessDbConnection { public static void main(String[] args) { …
hina abbasi
  • 445
  • 1
  • 4
  • 14
36
votes
8 answers

How do I create a table alias in MySQL

I am migrating an MS Access application (which has linked tables to a MSSQL Server) to MySQL. As a means to overcome some MSAccess table naming problems, I am seeking a solution to add a MySQL table alias that will point to an existing table in the…
rswolff
  • 3,258
  • 5
  • 28
  • 31
36
votes
8 answers

Classic ASP SQL Injection Protection

What is a strong way to protect against sql injection for a classic asp app? FYI I am using it with an access DB. (I didnt write the app)
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
35
votes
2 answers

How can I show an "&" (ampersand) in button or label text?

I would like to show the & character, not the keyboard shortcut in the text property of a button or label. Is there a way to do this?
atrueresistance
  • 1,358
  • 5
  • 26
  • 48
35
votes
7 answers

Lightweight SQL database which doesn't require installation

Could you recommend a lightweight SQL database which doesn't require installation on a client computer to work and could be accessed easily from .NET application? Only basic SQL capabilities are needed. Now I am using Access database in simple…
Alexander Prokofyev
  • 33,874
  • 33
  • 95
  • 118
35
votes
6 answers

Can we create multicolumn unique indexes on MS access databases?

We'd like to prevent record duplication in our MS access database using a multicolumn unique index. Because of how the data is sent (via network), duplicate data is sometimes received. The data source does not send a unique ID, so the simplest…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
34
votes
21 answers

What will we do after Access?

Microsoft seems hell-bent on deprecating the swiss-army-knife of database tools. What else comes close for facading/file-swapping/cloning/name-your-acronym-connecting arbitrary database servers/spreadsheets/CSV's/flatfiles? What weird kinds of…
dkretz
  • 37,399
  • 13
  • 80
  • 138
34
votes
1 answer

What does ApplicationIntent=ReadOnly mean in the connection string

I am using MS Access to connect to Sql Server through a DSN connection. This is a linked table to a sql server backend. Here is the connection string ODBC;DSN=mydsn;Description=mydesc;Trusted_Connection=Yes;APP=Microsoft Office…
Luke101
  • 63,072
  • 85
  • 231
  • 359
33
votes
6 answers

How do I test if a recordSet is empty? isNull?

How can you test if a record set is empty? Dim temp_rst1 As Recordset Dim temp_rst2 As Recordset Set temp_rst1 = db.OpenRecordset("SELECT * FROM ORDER_DATA WHERE SKUS_ORDERED = '" & curSKU1 & "' AND [ORDER] = " & curOrder) …
Shubham
  • 949
  • 6
  • 21
  • 29
33
votes
2 answers

How can I join two tables but only return rows that don't match?

I have two tables which look like this: T1: ID | Date | Hour | Interval T2: ID | Date | Hour I basically need to join these tables when their IDs, dates, and hours match. However, I only want to return the results from table 1 that do…
Breakthrough
  • 2,444
  • 2
  • 23
  • 37
33
votes
10 answers

How do you comment an MS-access Query?

How does one add a comment to an MS Access Query, to provide a description of what it does? Once added, how can one retrieve such comments programmatically?
Varun Mahajan
  • 7,037
  • 15
  • 43
  • 65
33
votes
5 answers

Export all MS Access SQL queries to text files

I have to document an MS Access database with many many macros queries, etc. I wish to use code to extract each SQL query to a file which is named the same as the query, eg if a query is named q_warehouse_issues then i wish to extract the SQL to a…
Pieter Nienaber
  • 343
  • 1
  • 3
  • 5
33
votes
3 answers

How do I count unique items in field in Access query?

My Table: table1 ID Name Family 1 A AA 2 B BB 3 A AB 4 D DD 5 E EE 6 A AC SQL command on Access: select count(*) from table1 Output: ------------> True 6 row(s) I tried to count unique names: Expected output:…
user1526510
32
votes
1 answer

How to select top 10 in Access query?

My Access database table has 2 columns: name and price. I want to do a query that select the top 10 highest prices. How to do this? Thanks.
RJIGO
  • 1,903
  • 7
  • 22
  • 31