Solved

How to insert a field into an exisiting table

Posted on 2011-02-13
7
373 Views
Last Modified: 2012-06-22
I have a few tables that I need to create two extra fields.  Here where I work it's not a problem, but the remote sites that use this don't have the expertise to do this.

What I would like is a function that checks the backend for a version and if it doesn't match then it asks to upgrade.  If the user says yes then it runs some type of code that inserts these fields into the table.

Is this possible?
0
Comment
Question by:John Sheehy
[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
  • 4
  • 3
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34884975
you can use the alter statement

alter table tableX add column colA text(25),colB  text(25)
0
 

Author Comment

by:John Sheehy
ID: 34884979
Can this be used in Access 2003 and I am using the front end to update the back end?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34884991
yes, you can use the codes in A2003, but you need to access the BE to alter the table. You can not alter the table structure in the linked table from the FE
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34885059
here is how to do this

sub alterBETable()
dim acObj as object, bePath
bepath="\\server\folder\be.mdb"
set acObj=createobject("access.application")
acobj.opencurrentdatabase  bePath
acobj.docmd.runsql "alter table tablex add column colA text(25),colB text(25)"

 
acObj.closecurrentdatabase
set acobj=nothing

end sub
0
 

Author Comment

by:John Sheehy
ID: 34885082
I have to run this from the backend?  What about an append query?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34885130
I have to run this from the backend?
Yes or you have to access the backend using codes from another db. using the codes i posted above

 What about an append query?
an append query adds records to the table
you can run an append query from the FE, appending records to the linked table
0
 

Author Comment

by:John Sheehy
ID: 34885170
Thank you once again.  This will work out just great.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

751 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