Access INSERT INTO VALUES: Step-by-Step Query Guide
In this article
You cannot run a bare INSERT INTO … VALUES statement in Microsoft Access the way you can in SQL Server or MySQL. Access accepts that syntax only through a pass-through query to a linked ODBC source, or by using the Access-specific INSERT INTO … SELECT … FROM … form with a single-row source. For a native Access table, the practical answer is to build an append query in the query designer, or run INSERT INTO TableName (Field1, Field2) SELECT 'Value1', 'Value2' in SQL view. This guide walks through both routes, plus the VBA and pass-through options, and covers the errors that trip people up.
What You'll Need
- Microsoft Access desktop application (Microsoft 365 or a recent perpetual version) with an .accdb database open.
- A table already created with the fields you intend to populate, and matching data types.
- Permission to modify data in the database file (it must not be opened read-only or from a locked network share).
- For pass-through queries: a working ODBC DSN to the external database and the correct credentials.
- For the VBA route: the VBA editor enabled and macro security set to allow the code to run.
Step-by-Step
Method 1: Append Query in the Query Designer (recommended for native tables)
- On the Create tab, click Query Design. The Add Tables pane opens.
- Close the Add Tables pane without adding anything; you will build the source manually.
- On the Design tab, click Append. The Append dialog appears.
- Choose the target table from the drop-down and click OK. The query grid now shows an Append To row.
- Add the source fields you want to insert. Because you have no source table, switch to SQL view (Design tab > View > SQL View) and type the values as a SELECT list. For example:
INSERT INTO Customers ( FirstName, LastName, City ) SELECT 'Ana' AS Expr1, 'Lopez' AS Expr2, 'Austin' AS Expr3;
- Click Run (the red exclamation mark). Access confirms how many rows will be appended; click Yes.
- Open the target table in Datasheet view to confirm the new row is present.
Note that menu labels can differ slightly by Access version and by region, but the Append button on the Design tab and the View > SQL View path have been stable for many releases.
Method 2: SQL View with INSERT INTO … SELECT
- On the Create tab, click Query Design, close the Add Tables pane, then switch to SQL view.
- Type the statement using the Access form. Access does not accept
VALUEShere; use a SELECT with literal values instead:INSERT INTO Products ( ProductName, UnitPrice, InStock ) SELECT 'Widget', 12.5, True;
- Use single quotes around text and dates in the format
#yyyy-mm-dd#, for example#2024-06-01#. Booleans areTrueandFalse. - Press Run and confirm the append.
Method 3: VBA with CurrentDb.Execute
- Press Alt+F11 to open the VBA editor.
- Insert a new module (Insert > Module) and write a short procedure:
Sub AddRow() CurrentDb.Execute "INSERT INTO Customers (FirstName, LastName) " & _ "SELECT 'Ana', 'Lopez'", dbFailOnError End Sub - Run the procedure with F5.
dbFailOnErrormakes Access raise an error if the insert fails, which is easier to debug than a silent failure.
Method 4: Pass-Through Query to an ODBC Source
- On the Create tab, click Query Design, close the Add Tables pane, then on the Design tab click Pass-Through.
- Open the property sheet (F4) and set ODBC Connect Str to your DSN, for example
ODBC;DSN=MyServer;UID=user;PWD=pass. - Set Returns Records to No for an insert.
- Switch to SQL view and type the native syntax for the target database, for example
INSERT INTO Customers (FirstName, LastName) VALUES ('Ana', 'Lopez'). - Run the query. The statement is sent verbatim to the server, so the syntax rules of that server apply, not Access's.
Common Mistakes
- Using VALUES against a native Access table. Access raises a syntax error. Use the SELECT form or an append query instead.
- Mismatched field counts. The number of fields in the field list must equal the number of expressions in the SELECT list, in the same order.
- Wrong data types. Text in a numeric field, or a date without # delimiters, causes a type conversion error.
- Forgetting required fields. If a field is set to Required with no default, the insert fails unless you supply a value.
- Violating a primary key or unique index. Duplicate values are rejected; check the target table's indexes.
- Quoting problems. Apostrophes inside text values break the SQL string. Double them up (
O''Brien) or use a parameter. - Running the query twice. An append query re-runs every time; use a unique key or a WHERE clause to prevent duplicate rows.
Tips
- Build the SELECT part first as a normal select query, confirm it returns exactly the rows and columns you want, then convert it to an append query.
- Use
dbFailOnErrorin VBA so failures surface immediately instead of silently. - Parameterise values in VBA with
QueryDefparameters rather than concatenating strings; this avoids quote errors and injection risks. - Keep a copy of the target table before a bulk insert so you can roll back if the data is wrong.
- For repeated inserts, consider a linked table or an import specification instead of hand-written SQL.
Troubleshooting
If the query will not run, work through these checks in order:
- Syntax error near VALUES. You are using VALUES against a native Access table. Rewrite as INSERT INTO … SELECT.
- Too few parameters. Access is treating a name as a parameter, usually a misspelled field or a value not quoted. Check spelling and quoting.
- Type conversion failure. Compare each value's type to the field's type in Design view; dates need #, text needs ', numbers need no quotes.
- Key violation. Inspect the table's primary key and unique indexes; remove or change the duplicate value.
- Operation must use an updateable query. The target is a linked or read-only source, or the query joins tables in a way Access cannot update. Run it as a pass-through query instead.
- Nothing happens. The query may have run but appended zero rows because the SELECT returned no rows. Run the SELECT alone to check.
- Permissions error. Confirm the database file is not read-only and that you have write access to the folder and the file.
Frequently Asked Questions
Can Access run INSERT INTO … VALUES directly?
Not against a native Access table. Access accepts VALUES only in a pass-through query sent to an external ODBC database. For local tables, use INSERT INTO … SELECT with literal values.
What is the difference between an append query and INSERT INTO?
They are the same operation. The query designer's Append button generates an INSERT INTO statement; you can view it in SQL view and edit it by hand.
How do I insert a date or a Yes/No value?
Wrap dates in # signs, for example #2024-06-01#, and use True or False for Yes/No fields.
How do I insert multiple rows at once?
Use a SELECT with UNION ALL between each row's SELECT statement, or run the append query repeatedly from VBA in a loop.
Why does my append query keep adding duplicates?
An append query runs every time you execute it. Add a WHERE NOT EXISTS clause or a unique index on the target table to block duplicates.
Can I undo an append query?
Only if you have not yet saved or compacted the database and the operation is still in the current transaction. Otherwise restore from a backup copy of the table.