DAO Alter Column Syntax

L

Lee Hunter

Will some one verify that the Alter Table statement is valid to change the
field type of the field "SeniorityNo" to be an Autonumber field. I have just
created the table using a copy structure and now wish to change the field
type from number to AutoNumber. If this is correct, will you please show the
proper syntac within DAO.

Thank you for your help

The error message from the Access query in SQL view is is "There is no field
named 'AutoNumber' in the 'NewEmpmaster'.

Dim CDb As Database
Set CDb = CurrentDb
DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb().Name,
acTable, "EmpMaster", "NewEmpMaster", True

ALTER TABLE NewEmpMaster ALTER COLUMN SeniorityNo AUTONUM
 
M

Michel Walsh

Hi,

It is COUNTER or AUTOINCREMENT, it is only with Jet 4.0.


CurrentDb.Execute "ALTER TABLE NewEmpMaster ALTER COLUMN SeniorityNo
AUTOINCREMENT"


(you can use DoCmd.RunSQL rather than CurrentDb.Execute, but with
CurrentDb.Execute, you can add a flag, as second argument, to be warned
through error trapping if an error occurred.)




Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top