Solved

Modify backend table with new field

Posted on 2016-07-26
4
53 Views
Last Modified: 2016-07-28
Environment Desktop Access 2013 database with front end and backend (standard).
When starting, a bat file copies a master FE to a temp area and then executes the FE from the temp area.
I have a number of different sites, each with their own separate network, the same copy of the FE and their own BE.
The BEs are structurally the same.
Problem: I need to add a field to the standard BE.
Normally, I put a new version of the FE to the various sites,  the FE software checks the version of the BE and if neccessary manipulates it so the BE is compatible with the new FE version.  For example, I can add a new table to the BE from a deployed FE.
The question is  - how do I code it so that it adds a field to a backend table.  I know how to do that for adding a field to a database but not when the table is linked.  Any ideas.
0
Comment
Question by:Keyboard Cowboy
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:als315
ID: 41729735
You can delete link, modify table, link again
0
 

Author Comment

by:Keyboard Cowboy
ID: 41729746
HOw do I modify the table while executing in the Front End.  Basically, how do I execute in one database and modify the structure of a  table (add a field) in another database.
Do you have any sort of code sample which does this?
0
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 41729753
You can use this code (correct names):
Dim dbs As DAO.Database
Set dbs = DBEngine.Workspaces(0).OpenDatabase("C:\Somepath\DBName.accdb")
dbs.Execute ("ALTER TABLE YourTableName ADD COLUMN FieldName Text(25)")

Open in new window

1
 

Author Comment

by:Keyboard Cowboy
ID: 41733184
Thanks - works like a charm.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

861 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

24 Experts available now in Live!

Get 1:1 Help Now