Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting error with Alter table code

Status
Not open for further replies.

hpicken

Technical User
Apr 12, 2001
142
AU
When I run code below, I get "syntax error in ALTER TABLE statement" when run. Running ACC2000 SP3 with DAO3.6 ref.

Anyone have any ideas?

Function NewField()

Dim dbs As Database

Set dbs = OpenDatabase("Y:\Access\datahold\consignmentdata.mdb")
dbs.Execute "ALTER TABLE Consigments ADD COLUMN DespatchDate DATE/TIME ;"
dbs.Execute "UPDATE Consignments SET DespatchDate = Now() WHERE printed = False ;"
dbs.Close
Set dbs = Nothing

End Function
 
Try replacing:
Code:
dbs.Execute "ALTER TABLE Consigments ADD COLUMN DespatchDate DATE/TIME ;"
with
Code:
dbs.Execute "ALTER TABLE Consigments ADD COLUMN DespatchDate DATE;"
[pc2]
 
Thanks that did it. Funny I found DATE/TIME, DATETIME in the VBA help but not just DATE on it's own

Once again thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top