Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Changing Properties of Fields in Table - VB Code needed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pele - 13 Jan 2008 18:03 GMT
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
Douglas J. Steele - 13 Jan 2008 18:13 GMT
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

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Below is part of a code that somebody had given me to change the property
> of
[quoted text clipped - 11 lines]
>
> Toks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.