Sinister Beard
Sinister Beard

Reputation: 3680

Run-time error '3001': Invalid Argument when creating a table in Access VBA

When creating a table in Access VBA using the following code:

Set tbl = dbs.CreateTableDef("" & strTableName & "")

I get the following error: Run-time error '3001': Invalid Argument. What causes this?

Upvotes: 2

Views: 10175

Answers (1)

Sinister Beard
Sinister Beard

Reputation: 3680

The name of the table you're trying to create (in the above example expressed as strTableName) is not valid - it's probably either null or too long.

The names of Access 2010 tables can be no longer than 64 characters. If strTableName is not null and has fewer than 64 characters, the above code will work perfectly.

Upvotes: 2

Related Questions