Re: Change table date/time field to text field in code



When I try this method, I am getting error 3293 Syntax error in ALTER TABLE
statement.
I am running it from a button on a form right now.

dixie


"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:438fe4f8$0$8584$5a62ac22@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> You can alter the column type by executing a DDL query.
>
> Example:
> Dim strSql As String
> strSql = "ALTER TABLE MyTable ALTER COLUMN MyField TEXT(20);"
> DBEngine(0)(0).Execute strSql, dbFailOnError
>
> I'm having difficulty imagining a scenario where it would be a good idea
> to use a Text type field to hold date/time data though. The approach would
> unleash a plethoria of issues, with criteria, sorting, date math, invalid
> entries, international format issues, and so on.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Dixie" <dixie@xxxxxxxxxxx> wrote in message
> news:438fe2d9$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>> How can I programatically, take some Date/Time fields present in a table
>> in the current database and change their type to text?
>>
>> dixie
>
>


.


Loading