New Field Data Type Question

J

Jake

Is there a way to build/run a make-table query that automatically creates an
empty field with a data type OTHER than text, and OTHER than binary?

I'm trying to automate a process where I don't have to go into the table's
design view to change the text field into another type.

Thanks,
Jacob
 
O

Ofer Cohen

You can always use Alter Table to add a new field to the table

CurrentDb.Execute "ALTER TABLE [TableName] ADD COLUMN MyDate DATETIME"
 
J

Jeff Boyce

Jacob

You've explained "how" you want to accomplish something.

Now, how 'bout the "why"?

It would be fairly unusual for a well-normalized relational database to need
to alter field types. What is it that's happening in your situation that
leads you to believe that you need to?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Spencer

Try using an expression like one of the following for the empty field you
are trying to create.

IIF(True,Null,Clng(1))

IIF(True,Null,CDbl(1))

IIF(True,Null,CBool(0))


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Top