Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Access INSERT INTO SQL: Step-by-Step How-To

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To run an INSERT INTO statement in Microsoft Access, open the database, go to Create > Query Design, close the Show Table dialog without adding tables, switch to SQL View, type your INSERT statement, and click Run. Access will ask you to confirm the append; click Yes. That is the whole procedure — the rest of this guide covers the exact syntax, the common errors, and how to verify the data landed in the right table.

What You'll Need

  • Microsoft Access desktop application (the browser version cannot run SQL statements).
  • A database file (.accdb or .mdb) that you can open and modify.
  • The exact table name and field names from your table design — Access is unforgiving about typos.
  • Values that match each field's data type (numbers without quotes, text in quotes, dates in # signs).

Step-by-Step

  1. Open the database. Launch Access and open the file that contains the target table. If the table is linked from an external source, confirm the link is active before you try to insert.
  2. Create a new query. On the ribbon, click Create, then Query Design. The Show Table dialog appears.
  3. Close the Show Table dialog. Do not add any tables. An INSERT statement does not need a table in the design grid, and adding one only clutters the view.
  4. Switch to SQL View. On the ribbon, click Design (or Query Design depending on your version), then View, then SQL View. Labels can differ slightly by Access version and region. You now see a blank SQL pane.
  5. Write the INSERT statement. The basic form is:
    INSERT INTO TableName (Field1, Field2) VALUES ('Text value', 123);
    Replace TableName and the field names with your real ones. Text values go in single quotes; numbers go bare; dates go in # signs, for example #2024-06-01#. If a field name contains spaces, wrap it in square brackets: [First Name].
  6. Check the field list against the table design. Right-click the table in the Navigation Pane and choose Design View to confirm exact spellings and which fields are required. Any field marked Required that you omit will cause the insert to fail unless it has a default value.
  7. Run the query. Click Run on the ribbon (the red exclamation mark). Access displays a warning that you are about to append rows; click Yes.
  8. Verify the data. Open the target table in Datasheet View and scroll to the new record, or run a simple SELECT query such as SELECT * FROM TableName; to confirm the row exists with the values you expected.
  9. Save the query if you will reuse it. Press Ctrl+S, give it a name, and close it. Saving is optional — the data is already committed once the append runs.

Common Mistakes

Quoting text with double quotes. Access SQL expects single quotes around text values. Double quotes often cause a syntax error or get interpreted as an identifier.

Forgetting the field list. If you write INSERT INTO TableName VALUES (...) without naming fields, Access expects a value for every column in table order, including AutoNumber fields. Always list the fields explicitly.

Mismatched data types. Putting text into a Number field, or a date without # delimiters, triggers a type conversion error. Check the table design first.

Reserved words as field names. Names like Date, Value, or Password can confuse the parser. Wrap them in square brackets.

Running the query twice. An INSERT has no undo. If you click Run, confirm, and then run again, you get a duplicate row. Verify before re-running.

Using the browser version. Access for the web does not support running SQL statements. Use the desktop application.

Tips

Test your statement as a SELECT first: write SELECT 'Text value' AS Field1, 123 AS Field2; to confirm the values parse correctly before converting it to an INSERT. This catches quoting and type errors without touching your data.

Use a parameter query if you will insert the same shape of data repeatedly — it avoids retyping values and reduces quoting mistakes.

Back up the database file before bulk inserts. A copy of the .accdb takes seconds and gives you a clean rollback point.

If you need to insert many rows, Access accepts multiple VALUES groups in one statement in recent versions, but the safest cross-version approach is one INSERT per row or an append query built in the designer.

Troubleshooting

Syntax error in INSERT INTO statement. Usually a missing parenthesis, a stray comma, or a field name with a space that is not bracketed. Compare your statement character by character with the template above.

“Cannot add or change a record because a related record is required.” A foreign key constraint is failing — the value you are inserting does not exist in the parent table. Insert the parent record first.

“Field cannot be updated.” You are trying to write to a calculated field, an AutoNumber field, or a field in a linked table that is read-only. Remove that field from the INSERT.

The query runs but no row appears. Check that you are looking at the correct table and that the record was not filtered out. Run a SELECT with a WHERE clause on a unique value you inserted.

Access asks for a parameter value. This means Access does not recognise a name in your statement — usually a misspelled field or table name. Correct the spelling.

If that did not work, close the query without saving, reopen the table in Design View to confirm names, and rebuild the statement in a fresh query. If the database is shared, confirm no one else has the table locked.

Frequently Asked Questions

Can I run INSERT INTO in Access without writing SQL?

Yes. Build an Append query in Query Design: add the source table or type values into the grid, then set the query type to Append and choose the destination table. Access generates the SQL for you.

Does Access support INSERT INTO ... SELECT?

Yes. You can copy rows from one table to another with INSERT INTO Target (Field1, Field2) SELECT Field1, Field2 FROM Source;. The field counts and types must match.

Why does Access put # around dates?

Access uses # as the date delimiter in SQL so it can distinguish a date literal from text. Without it, a date string may be treated as text and rejected by a Date/Time field.

Can I undo an INSERT?

Not with Ctrl+Z after the query has run. The row is committed. Delete it manually or restore from a backup taken before the insert.

Does this work in Access for the web?

No. SQL statement execution is a desktop-only feature. The browser version supports table editing through forms and datasheets but not direct SQL.

How do I insert a NULL value?

Use the keyword NULL without quotes: INSERT INTO TableName (Field1, Field2) VALUES ('Text', NULL); The field must allow nulls in its table design.