Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

How to insert a field into an exisiting table

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
John Sheehy
Asked:
John Sheehy
  • 4
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:
you can use the alter statement

alter table tableX add column colA text(25),colB  text(25)
0
 
John SheehyCommunications EgineerAuthor Commented:
Can this be used in Access 2003 and I am using the front end to update the back end?
0
 
Rey Obrero (Capricorn1)Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Rey Obrero (Capricorn1)Commented:
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
 
John SheehyCommunications EgineerAuthor Commented:
I have to run this from the backend?  What about an append query?
0
 
Rey Obrero (Capricorn1)Commented:
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
 
John SheehyCommunications EgineerAuthor Commented:
Thank you once again.  This will work out just great.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now