Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    create new field of table in remote db through cod (Access 2000)

    Can you help me with creating a new field of a table? I need to open a remote database called College.mdb, open a table there called "Lessons" and
    open a new field with format Currency called "fees",Decimal Placess Auto.
    I need to do it with a code from the current database without leaving the current database`but creating a new field in the remote database

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: create new field of table in remote db through cod (Access 2000)

    ADO or DAO code? And why do you need to do it from code?
    Charlotte

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: create new field of table in remote db through cod (Access 2000)

    If you want to use DAO, you can use code like the following. You must have a reference to the Microsoft DAO 3.6 Object Library (in Tools/References...) in order for this code to work.

    Dim wsp As DAO.Workspace
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Set wsp = DAO.DBEngine.Workspaces(0)
    Set dbs = wsp.OpenDatabase("C:MyDirCollege.mdb")
    Set tdf = dbs.TableDefs("Lessons")
    Set fld = tdf.CreateField("Fees", dbCurrency)
    tdf.Fields.Append fld
    tdf.Fields.Refresh
    dbs.Close
    Set fld = Nothing
    Set tdf = Nothing
    Set dbs = Nothing
    Set wsp = Nothing

Posting Permissions

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