?
Solved

Delete a Column from Access (DAO)

Posted on 2014-04-21
9
Medium Priority
?
532 Views
Last Modified: 2014-04-22
Hello All,

How do i use DAO to remove a existing column?

thank you
0
Comment
Question by:Rayne
  • 3
  • 3
  • 2
8 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 40013935
use this command


currentdb.execute "alter table tablename drop column columnname"
0
 
LVL 46

Accepted Solution

by:
aikimark earned 1000 total points
ID: 40013940
something like this:
dbengine(0)(0).TableDefs("yourtablename").Fields.Delete  "yourfieldname"

Open in new window

0
 

Author Comment

by:Rayne
ID: 40013976
Thank you all,

AikiMark, this is Awesomosity in just one line :)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40013989
my post that was posted earlier is also a one liner ?????
0
 

Author Comment

by:Rayne
ID: 40014002
Hello Rey,

Sure, I understand.  I was looking for something that could use variables so that its reusable and dynamic :)
and something I can use as standalone function and pass column variables to delete the ones I want..
0
 
LVL 46

Expert Comment

by:aikimark
ID: 40014451
@Rayne
I was looking for something that could use variables
You can.
currentdb.execute "alter table " & yourtablenamevariable & " drop column " & yourcolumnnamevariable

Open in new window

In the above version of Rey's statement, the two variable name references could also be parameter names to a routine in which this statement resides.
0
 

Author Comment

by:Rayne
ID: 40014464
thank you Aikimark for indicating that.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40014617
@Rayne
I was looking for something that could use variables

you should have included that in your original posts.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question