Others

How to Fix VBA CreateTableDef Error 3264 with a DSN-Less Access Link

Huma Ashraf ChHuma Ashraf Ch Oct 26, 2026 868 views

Question details

The user is attempting to create a new linked SQL Server table using a DSN-less connection in VBA but encounters Error 3264.

How to Fix VBA CreateTableDef Error 3264 with a DSN-Less Access Link
Product
Microsoft Access
Device & OS
not provided
Scenario
Creating a new linked SQL Server table via VBA code using the CreateTableDef method with a DSN-less connection string.
Observed behavior
Microsoft Access triggers Error 3264, 'No field defined; cannot append TableDef or Index,' because the VBA script fails to preserve the saved password attribute.
Before you start

Verify that your SQL Server credentials are correct and that the database connection string is properly formatted in your VBA script before making modifications.

Solution 1Recommended

Pass the dbAttachSavePWD Attribute to CreateTableDef

Modify your VBA TableDef creation code to explicitly pass the dbAttachSavePWD attribute so Access correctly retains the required password information.

When VBA attempts to append a linked SQL Server table using a DSN-less connection, it requires authentication credentials to maintain the link. If the dbAttachSavePWD attribute is omitted, Microsoft Access does not preserve the password, which subsequently triggers Error 3264 when you try to append the TableDef object to the database.

1
Open the VBA Editor

In Microsoft Access, press ALT + F11 to launch the Visual Basic for Applications (VBA) editor.

2
Locate the CreateTableDef Script

Navigate to the specific module or subroutine where you define the DSN-less connection string and execute the CreateTableDef method.

3
Modify the Attributes Parameter

Update the CreateTableDef call to include the dbAttachSavePWD constant. For example: Set td = CurrentDb.CreateTableDef(TableName, dbAttachSavePWD, SourceTableName, ConnectionString).

4
Append the TableDef

Ensure your code uses the Append method (e.g., CurrentDb.TableDefs.Append td) immediately after configuring the TableDef object to successfully link the new table.

Connection Secured: By saving the password attribute, the TableDef will now append correctly without raising Error 3264, allowing the DSN-less linked table to function properly.
Free Microsoft Office alternative

Enhance Your Data Management with WPS Office

While Microsoft Access is widely used for specialized database operations, managing large datasets and complex macros can often be executed more efficiently using advanced spreadsheets. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office. It seamlessly supports VBA macros and provides intuitive data management tools without the heavy resource overhead.

  1. 1. Download and Install: Visit the official WPS Office website to download the free suite. Run the installation wizard to set it up on your device.
  2. 2. Open Your Datasets: Launch WPS Spreadsheet and open your existing .xlsx or .csv files to organize and structure your data seamlessly.
  3. 3. Run Custom VBA Macros: Use the built-in Developer tools to port and execute your existing VBA scripts for comprehensive data automation.
Fully compatible with Microsoft Excel file formats (.xls, .xlsx, .xlsm, .csv).Advanced VBA macro support for automating repetitive data processing tasks.Lightweight application design that consumes significantly fewer system resources.Familiar, tabbed interface to ensure a seamless transition from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

What does Error 3264 mean in Microsoft Access VBA?

Error 3264, titled 'No field defined; cannot append TableDef or Index,' typically occurs when Access fails to append a new table definition. In the context of linked tables, this frequently happens when connection parameters, such as passwords, are not correctly saved during a DSN-less connection setup.

What is a DSN-less connection?

A DSN-less connection connects directly to a database server by hardcoding driver specifications, server names, and credentials directly into the connection string inside your code, bypassing the need to configure a local Data Source Name (DSN) via Windows ODBC tools.

Why is dbAttachSavePWD necessary when linking SQL Server tables?

When connecting to an external database like SQL Server without an active trusted connection, Access must explicitly store the credentials locally. Passing dbAttachSavePWD tells Access to cache the password with the linked table, preventing persistent authentication failures.

Can I run my database macros in WPS Office?

WPS Office does not include a direct Microsoft Access database clone. However, WPS Spreadsheet offers robust VBA and macro support, allowing you to run complex data manipulation and calculation scripts on standard spreadsheet formats with high compatibility.