Link to home
Start Free TrialLog in
Avatar of howcheat
howcheatFlag for United States of America

asked on

add field to database with alter

I am trying to add the following columns to a table and I get the error message "syntax error in field definition" on the first command.

Public Sub AdColumns()
Dim myDb As DAO.Database
Set myDb = CurrentDb

myDb.Execute "Alter Table PIIN_LOG Add COLUMN HN_IRAQI BUSINESS YES/NO(4);"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN [# IRAQIS EMPLOYED] LONG;"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN Province_City CHAR(50);"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN v_IRAQISEMPLOYED CHAR LONG;"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN [First Tier Subcontractor] YESNO;"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN [# Iraqis employed on first tier subcontract] LONG);"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN [Reason for Non-Award] CHAR(250);"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN Unit CHAR(50);"
myDb.Execute "Alter Table PIIN_LOG Add COLUMN [Dollar value under HN subcontract] MONEY;"

myDb.Close
End Sub
Avatar of jmantha709
jmantha709

Should be :

myDb.Execute "Alter Table PIIN_LOG Add COLUMN HN_IRAQI BUSINESS YESNO;"
ASKER CERTIFIED SOLUTION
Avatar of jmantha709
jmantha709

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, glad I could help.  Strange that help says it should be Bit, but YesNo also works - Oh well that's MS.