Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Posts
    3

    Question Unanswered: how to manipulate a table thru VB

    hi
    I have a table and I want to add/Delete a column/field to it using VB..is that possible?
    If yes how can I do that.
    Any help would b greatly appreciated.
    Thanks
    Jeet

  2. #2
    Join Date
    Dec 2001
    Posts
    79
    Sure, you need to use the Alter Table statement.

    Ex. (from Access Help):

    Sub AlterTableX2()

    Dim dbs As Database

    ' Modify this line to include the path to Northwind
    ' on your computer.
    Set dbs = OpenDatabase("Northwind.mdb")

    ' Delete the Salary field from the Employees table.
    dbs.Execute "ALTER TABLE Employees " _
    & "DROP COLUMN Salary;"

    dbs.Close

    End Sub

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •