Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2006, 12:54 PM
Registered User
 
Join Date: Jan 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing column datatype

Hi,

I'm trying to change the datatype of the column 'test' from Number to Date/Time in the table 'tbltest' using a SQL statement. This is my code:

    STRSQL = "ALTER TABLE tbltest MODIFY (test DATETIME)"
    DoCmd.RunSQL STRSQL

However when I run the docmd I get a run time error:

"Syntax error in ALTER TABLE statement"

Any idea would be appreciated.

Pedro

 
Old January 16th, 2006, 07:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Pedro,

strSQL = "ALTER TABLE tbltest ALTER COLUMN test DateTime;"

HTH,

Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
Datatype mismatch on datetime column??? reidcor SQL Server DTS 3 May 9th, 2005 02:13 PM
changing values in a column on a databound datagri mischa78 C# 1 May 25th, 2004 07:47 AM
Changing Datatype In Access Database fastcorvette Pro VB 6 9 October 8th, 2003 11:57 AM
Changing Datatype In Access Database fastcorvette Access 2 October 8th, 2003 11:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.