Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old June 12th, 2006, 12:20 PM
Registered User
Join Date: Jun 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to scubasteve
Default Changing table field types in VB

I have a XML data file I receive that comes into Access 2003. All the fields are defined as Text, however, there are two fields that need to be Number/Double. There is no way I am going to be able to have the XML file changed. Is there some way through VB code to change the data type on this table on the fly through calling the code in a macro? I don't want to have to stop and change the data types manually.

Thank you.


  #2 (permalink)  
Old June 12th, 2006, 12:24 PM
Friend of Wrox
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts

I have a similar thing that I need to do.

My work around is as follows.

I declare ADODB Connection called cn and then

strSQL = "ALTER TABLE " & strTableName & " ALTER COLUMN [Allocation Amount] CURRENCY"

cn.Execute strSQL
That changes the datatype from a string to currency, and I would assumed that you could change it to a Number or Double just as easily.


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing rs.field to records gilgalbiblewheel Classic ASP Databases 1 June 22nd, 2007 10:40 PM
MySQL table types madhukp PHP Databases 1 December 16th, 2004 03:44 PM
Single and Double data types in vb Luke24 Beginning VB 6 1 November 1st, 2004 03:06 PM
BLOB field file types kend SQL Server ASP 0 December 19th, 2003 02:45 PM

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