Connecting Tech Pros Worldwide Help | Site Map

Changing back end database

Expert
 
Join Date: Apr 2007
Posts: 192
#1: May 30 '07
I have done this so many times, but now forgotten how I did it.

I need to programaticaly change the backend database, i.e. add tables, relationships, fields etc. (This is because the live system, that needs changing, is in West Africa, I am in London)

I remember all about ALTER TABLE and CREATE TABLE etc, but I can't seem to attach to the back end database from my code database

dim db as database
set db="Z:\bissau\bissaudata.mdb"

gives me a Type Mismatch on compile.

I've search this forum, gone through my old code and even looked in some manuals but can't find the solution.

TIA
Newbie
 
Join Date: May 2007
Posts: 1
#2: May 31 '07

re: Changing back end database


Quote:

Originally Posted by Lysander

I have done this so many times, but now forgotten how I did it.

I need to programaticaly change the backend database, i.e. add tables, relationships, fields etc. (This is because the live system, that needs changing, is in West Africa, I am in London)

I remember all about ALTER TABLE and CREATE TABLE etc, but I can't seem to attach to the back end database from my code database

dim db as database
set db="Z:\bissau\bissaudata.mdb"

gives me a Type Mismatch on compile.

I've search this forum, gone through my old code and even looked in some manuals but can't find the solution.

TIA


Hi,

open a workspace first and

Set db=workspace.opendatabase([path])

extract path info from the connected table, remove the tabledef from your database and reconnect it:

Private Sub ConnectTable(SourceDb, tbl)
DoCmd.TransferDatabase acLink, "Microsoft Access", SourceDb, acTable, tbl, tbl, False
End Sub
Expert
 
Join Date: Apr 2007
Posts: 192
#3: May 31 '07

re: Changing back end database


Quote:

Originally Posted by Klapperstorch

Hi,

open a workspace first and

Set db=workspace.opendatabase([path])

extract path info from the connected table, remove the tabledef from your database and reconnect it:

Private Sub ConnectTable(SourceDb, tbl)
DoCmd.TransferDatabase acLink, "Microsoft Access", SourceDb, acTable, tbl, tbl, False
End Sub

ah, opendatabase, knew it would be something simple, thanks
Reply