Updating design changes to live database

  • Thread starter Thread starter David H
  • Start date Start date
D

David H

Hi

How can I update a database on another computer with design changes without
overwriting the data.

David H
 
You can use DAO, ADOX or DDL.

For DAO, you create a reference to the "other" database, create a reference
to the table in question, then add or delete fields from it:

Dim dbChange As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim fldCurr As DAO.Field

Set dbChange = OpenDatabase("E:\Databases\Backend.mdb")
Set tdfCurr = dbChange.TableDefs("Changing")
Set fldCurr = tdfCurr.CreateField("NewField', "Text", 50)
tdfCurr.Fields.Append fldCurr

Set fldCurr = Nothing
Set tdfCurr = Nothing
dbChange.Close
Set dbChange = Nothing

A good reference for this is
http://www.aislebyaisle.com/access/vba_backend_code.htm

ADOX is very similar, except the actual objects with which you're working
are different (sorry, too lazy to type up an example!)

DDL is perhaps a little more understandable:

Dim dbChange As DAO.Database
Dim strDDL As String

strDDL = "ALTER TABLE Changing ADD COLUMN NewField Text(50)"

Set dbChange = OpenDatabase("E:\Databases\Backend.mdb")
dbChange.Execute strDDL, dbFailOnError

dbChange.Close
Set dbChange = Nothing


You can get more information at http://support.microsoft.com/?id=180841
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top