PC Review


Reply
Thread Tools Rate Thread

Changing data type from Text to Yes/No

 
 
=?Utf-8?B?UmljdGVy?=
Guest
Posts: n/a
 
      2nd Aug 2006
I'm considering changing a field's data type to Yes/No, from Text, to save
space in the future. Can I do this simply without altering the table's
current data (which is either -1 or 0)?
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      2nd Aug 2006
Sure. Back up the database in case something goes wrong.
Then open the table in design view and change the field type.

If you need to do it programmatically:
strSql = "ALTER TABLE MyTable ALTER COLUMN MyField YESNO;"
DBEngine(0)(0).Execute strSql, dbFailOnError

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Ricter" <(E-Mail Removed)> wrote in message
news:2600B810-EE59-441C-8754-(E-Mail Removed)...
> I'm considering changing a field's data type to Yes/No, from Text, to save
> space in the future. Can I do this simply without altering the table's
> current data (which is either -1 or 0)?



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmljdGVy?=
Guest
Posts: n/a
 
      2nd Aug 2006
Thanks, Allen.

"Allen Browne" wrote:

> Sure. Back up the database in case something goes wrong.
> Then open the table in design view and change the field type.
>
> If you need to do it programmatically:
> strSql = "ALTER TABLE MyTable ALTER COLUMN MyField YESNO;"
> DBEngine(0)(0).Execute strSql, dbFailOnError
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Ricter" <(E-Mail Removed)> wrote in message
> news:2600B810-EE59-441C-8754-(E-Mail Removed)...
> > I'm considering changing a field's data type to Yes/No, from Text, to save
> > space in the future. Can I do this simply without altering the table's
> > current data (which is either -1 or 0)?

>
>
>

 
Reply With Quote
 
SusanV
Guest
Posts: n/a
 
      3rd Aug 2006
Hi Ricter,

Add a new Boolean field to the table, then run an update query to populate
that field based on your current text field. Then modify any forms, reports
and queries to use the new Yes/No field rather than the text field (don't
forget any sorting and grouping done on the text field, or you'll have
errors later on). Once that's done you can either delete the text field or
simply not reference it in any of your forms, reports and queries, leaving
the data intact for historical reference. (Personally I hate to delete
data - you never know when it might come back to bite you)

--
hth,
SusanV



"Ricter" <(E-Mail Removed)> wrote in message
news:2600B810-EE59-441C-8754-(E-Mail Removed)...
> I'm considering changing a field's data type to Yes/No, from Text, to save
> space in the future. Can I do this simply without altering the table's
> current data (which is either -1 or 0)?



 
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
Convert a Number data type to a Text data type TKM Microsoft Access Queries 9 6th Nov 2008 10:59 PM
VBA Import Convert Data Type from Type 1 to Type 2 u473 Microsoft Excel Programming 3 21st Oct 2008 08:22 PM
Data in a text box depending on the type of data choosing "text" Fred's Microsoft Access 2 12th Dec 2007 06:03 PM
Append Data Type Text Y/N to Data Type Y/N in Query HELP! =?Utf-8?B?dHJveQ==?= Microsoft Access Queries 1 25th Apr 2006 01:11 AM
Change Memo data type to Text data type DS Microsoft Access Getting Started 1 26th Jan 2005 05:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:58 PM.