Syntax error in Alter Table statement - Run-time error '3293':

JGravesNBS

Registered User.
Local time
Yesterday, 21:37
Joined
Apr 5, 2014
Messages
58
I'm getting following error message on following Alter command:

Run-time error '3293':
Syntax error in Alter Table statement

dbs.Execute "ALTER TABLE Customers ADD COLUMN dtmDateCreate DATE DEFAULT Date();"

Also, what is the syntax to add the following to the Alter statement?

Format mm/dd/yyyy
Input Mask 90/90/99;0;_
Caption Create
 
I wonder if it's this from MSDN:

The DEFAULT statement can be executed only through the Access OLE DB provider and ADO. It will return an error message if used through the Access SQL View user interface.
 
You can change the field property after you've created the field.
So first:
Code:
dbs.Execute "ALTER TABLE Customers ADD COLUMN dtmDateCreate DATE;
Then
Code:
dbs.TableDefs("Customers").Fields("dtmDateCreate").DefaultValue = "Date()"
 
Thanks for the solution that worked

How about the syntax to add the following to dtmDateCreate

Format mm/dd/yyyy
Input Mask 90/90/99;0;_
Caption Create
Required Yes
Indexed Yes

dbs.TableDefs("Customers").Fields("dtmDateCreate").Format = "mm/dd/yyyy)"

Returns Compile error: Method or data member not found
 

Users who are viewing this thread

Back
Top Bottom