PC Review


Reply
Thread Tools Rate Thread

Delete field from table in VBA

 
 
=?Utf-8?B?SmVzc2ljYQ==?=
Guest
Posts: n/a
 
      20th Jun 2005
Greetings!

How do I use VBA to delete an entire field from a table? I initially need
this field, but later I would like to get rid of the field entirely. I do
not want users going into the table design to delete this field, and would
rather use VBA to delete the field. Any suggestions?

Jessica

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      20th Jun 2005
This should do it:
strSql = "ALTER TABLE [MyTable] DROP COLUMN [DeleteMe];"
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.

"Jessica" <(E-Mail Removed)> wrote in message
news:E8A5F8C5-7987-4FD8-9E6F-(E-Mail Removed)...
> Greetings!
>
> How do I use VBA to delete an entire field from a table? I initially need
> this field, but later I would like to get rid of the field entirely. I do
> not want users going into the table design to delete this field, and would
> rather use VBA to delete the field. Any suggestions?
>
> Jessica



 
Reply With Quote
 
=?Utf-8?B?SmVzc2ljYQ==?=
Guest
Posts: n/a
 
      20th Jun 2005
That worked. Thank you!

"Allen Browne" wrote:

> This should do it:
> strSql = "ALTER TABLE [MyTable] DROP COLUMN [DeleteMe];"
> 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.
>
> "Jessica" <(E-Mail Removed)> wrote in message
> news:E8A5F8C5-7987-4FD8-9E6F-(E-Mail Removed)...
> > Greetings!
> >
> > How do I use VBA to delete an entire field from a table? I initially need
> > this field, but later I would like to get rid of the field entirely. I do
> > not want users going into the table design to delete this field, and would
> > rather use VBA to delete the field. Any suggestions?
> >
> > Jessica

>
>
>

 
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
Delete record from one table, set field in another table to no Allison Microsoft Access Form Coding 5 16th Apr 2009 08:26 PM
How do I delete All from the page field of a pivot table? lmkatz Microsoft Excel Misc 0 23rd Jan 2009 02:24 AM
Delete a field from a table =?Utf-8?B?VG9tbW9VSw==?= Microsoft Access VBA Modules 1 2nd Jul 2006 11:03 AM
Delete item from Pivot Table field? =?Utf-8?B?U3RlcGhlbg==?= Microsoft Excel Charting 1 23rd Sep 2005 04:46 PM
How do you delete a field name within a table? =?Utf-8?B?bWljaGVsbGU=?= Microsoft Access 1 8th Sep 2004 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:32 PM.