PC Review


Reply
Thread Tools Rate Thread

Changing Properties of Fields in Table - VB Code needed

 
 
Pele
Guest
Posts: n/a
 
      13th Jan 2008
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      13th Jan 2008
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

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


"Pele" <(E-Mail Removed)> wrote in message
news:7DAB69E0-48B8-40D9-86BC-(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the format of table fields with code =?Utf-8?B?QWxlamFuZHJv?= Microsoft Access VBA Modules 4 24th Oct 2007 11:58 PM
What needed to do before use fields in a table =?Utf-8?B?Y2xhcmE=?= Microsoft Access Forms 0 15th Mar 2007 08:12 PM
Table Fields and Properties =?Utf-8?B?UG9zc2VKb2hu?= Microsoft Access Database Table Design 1 22nd Mar 2006 08:30 AM
Changing control properties/code through code =?Utf-8?B?QWppdA==?= Microsoft Excel Programming 3 18th Oct 2004 09:03 PM
Changing properties of muliple fields in table at once Spidey3721 Microsoft Access 0 13th Nov 2003 08:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:12 AM.