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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Change the Data Type in a Table via VBA

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi,

How Do I Change the Data Type in a Table using VBA?

Thanks.
 
I don't know if this will help you or not because I do most of my work in SQL, but have you tried doing an

strsql = "ALTER TABLE [tablename]
ALTER [columnname] newdatatype"

as a SQL statement run from docmd.runsql (strSQL)?

Just know that if you change the datatype of a field to one that is smaller or distinctly different from the data being held now, you will lose the data in that field.

Make datatype changes with extreme caution.
 
Is that the actual syntax for altering a field in an existing tables because i'm getting errors and can't figure out why.
 
I am still trying to figure out why you would want to do this? Realize this effects everything from the data stored in the table, to the forms and reports based on this table. Seems like you are going to spend more time DEVELOPING code then you are DESIGNING the table right in the first place. Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
A silly question?

Once a table is established, why would someone want to change attributes "on-the-fly"?

Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top