Changing Table Definitions

bstice

Registered User.
Local time
Today, 11:18
Joined
Jul 16, 2008
Messages
55
I am trying to figure out how to automate changing a table definition from number to text with VBA. Lets say, I have a field that is named "Order Number." It always imports as a number because the first few values in the import file are purely numbers. I need to treat it as a text value in my db. What code would I use to change that so I don't have to go into the design view of the table everytime I import new data? Thanks all

Brennan
 
I suppose you could use the SQL ALTER TABLE statement but in my opinion, I don't think it's a good idea to be flipping your Data Types around all the time.

Set the field to a Data Type you will be happy with to accomodate the incoming data and when working with that data, merely use whichever MS-Access Type Conversion Functions (CStr(), CInt(), CLng(), CDate()....etc) needed to carry out the task.

.
 

Users who are viewing this thread

Back
Top Bottom