Solved Add a column to a Linked table (1 Viewer)

InFlight

User
Local time
Today, 18:47
Joined
Jun 11, 2015
Messages
130
Hi
I have a database that I need to add a column to a table in a linked database.

eg
C:\Test\test.accdb

linked DB is
C:\Test\Data\Data.accdb
the table is Exhibitors and the I'm trying to add is Certificate YESNO

using VBA
CurrentDb.Execute "Alter Table Exhibitors add column Certificate YESNO"

I have quite a few to update around the country all with different data
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:47
Joined
Feb 19, 2002
Messages
42,981
I don't know why you want to do this via VBA. That is not normal practice. However, I have an application which is sold to the public and so if release an upgrade, I can't personally apply it so I create a custom upgrade .accdb for each ver-ver change. I'll attach a database so you can see how it works. Open the db and put the form in design view to see how it works.
 

Attachments

  • DEA_Ver37toVer38.zip
    213.3 KB · Views: 262

bastanu

AWF VIP
Local time
Yesterday, 22:47
Joined
Apr 13, 2010
Messages
1,401
In addition to using the ALTER TABLE you could "push" and empty table to the back-end from the front-end, please see my example here:

Cheers,
 

isladogs

MVP / VIP
Local time
Today, 05:47
Joined
Jan 14, 2017
Messages
18,186
Code:
Dim db As DAO.Database
Set db = OpenDatabase("C:\Test\Data\Data.accdb")

db.Execute "ALTER TABLE Exhibitors ADD COLUMN Certificate YESNO;"
 

sxschech

Registered User.
Local time
Yesterday, 22:47
Joined
Mar 2, 2010
Messages
791
Here is a table editor form I developed based on various code snippets I found from a few websites to allow editing a local or linked table which I used during development. Allows changing name(s) of fields, adding and removing fields etc.

Import the three objects (tblTableActions, frmTableEditor and modTableEditor) into your database.
To use, open frmTableEditor and select the table and action.
 

Attachments

  • TableEditorEmpty.accdb
    612 KB · Views: 273
  • TableEditorScreenShots_20210415.pdf
    109.3 KB · Views: 272

Users who are viewing this thread

Top Bottom