Solved

Modify backend table with new field

Posted on 2016-07-26
4
47 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now