Solved

Delete a Column from Access (DAO)

Posted on 2014-04-21
9
507 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
9 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
ID: 40013935
use this command


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

Accepted Solution

by:
aikimark earned 250 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
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40013989
my post that was posted earlier is also a one liner ?????
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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 45

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 119

Expert Comment

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

you should have included that in your original posts.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Outlook Free & Paid Tools
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now