Changing Properties of Fields in Table - VB Code needed

P

Pele

Below is part of a code that somebody had given me to change the property of
a field (in this case to make the field a required field).

fld1.properties("Required") = True

What do I need to do if I want to modify this line of code to do the
following:

a) Change a field to have a DATATYPE of Number
b) FIELD SIZE should be DOUBLE

Any help will be appreciated.

Toks
 
D

Douglas J. Steele

You cannot change data types in that way.

Your choices are:

1) Create a new field of the correct type, run an Update query to transfer
the data from the old field to the new field, delete the old field then
rename the new field

2) Use DDL (Data Definition Language)

ALTER TABLE NameOfTable ALTER COLUMN NameOfField NewDataType

ALTER TABLE MyTable ALTER COLUMN Field3 Double

The data types in DDL are:

Binary BINARY
Boolean YESNO
Byte BYTE
Currency CURRENCY
Date/Time DATETIME
Decimal DECIMAL
Double DOUBLE
GUID GUID
Integer INTEGER
Long LONG
Long Binary (OLE Object) IMAGE
Memo MEMO
Single SINGLE
Text TEXT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top