Solved

Modify backend table with new field

Posted on 2016-07-26
4
71 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

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 40

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

737 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