The way I do an upgrade, if they install "MyApp2000" and previously had
"MyApp97", is that I have in the startup routine:
a) to detect a blank BE database ie no registration details
b) off to import table data from the old database, and give them a facility to
find the old database to import
c) using standard Access facilities, do you want to know general principles or
employ someone to write the whole thing for you?
d) The BE doesn't technically need converting at all, though it's best if it
is converted otherwise Repair/Compact might not work.
Ok, I'll write it, even though you are paid to be a developer. Some of this
may be more specific than you need.
(during startup)
If IsNull(rstConfig![Authorisation]) And IsNull(rstConfig!CompanyName) Then
Question = "New Installation" + Chr$(13) + Chr$(10) + Chr$(13) + Chr$(10)
+ "Do you wish to import data from a previous version of MyApp?"
gintResult = MsgBox(Question, MB_YESNO + MB_ICONINFORMATION +
MB_DEFBUTTON1, SYSNAME)
If gintResult = IDYES Then
DoCmd.Hourglass False
DoCmd.OpenForm "UpgradeImportDatabase", , , , , acDialog
DoCmd.Hourglass True
Set rstConfig = db.OpenRecordset("CONFIG", dbOpenDynaset)
End If
End If
....whatever
Form UpgradeImportDatabase:
(Select or find the db to import)
Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click
Dim MyWS As Workspace
Dim db As Database, dbs As Database
Dim Q As String
Dim strDBName As String
DoCmd.Hourglass True
If ([FileList].ListIndex = -1) Then GoTo Exit_cmdOK_Click
If Not IsNull([ImportDir]) Then
If Right([ImportDir], 1) <> "\" Then
[ImportDir] = [ImportDir] + "\"
End If
End If
strDBName = [ImportDir] & [FileList]
Set db = CurrentDb()
Set MyWS = DBEngine.Workspaces(0)
Set dbs = MyWS.OpenDatabase(strDBName)
On Error Resume Next
'Drop any existing temp tables from a leftover abort
db.Execute ("Drop Table ImportTempTable1")
db.Execute ("Drop Table ImportTempTable2")
(...whatever)
On Error GoTo Err_cmdOK_Click
'Import the data to temp tables in the current database
DoCmd.TransferDatabase acImport, "Microsoft Access", strDBName, acTable,
"Table1", "ImportTempTable1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", strDBName, acTable,
"Table2", "ImportTempTable2", False
'Delete any existing data in the current db, since you are importing new data.
There may be relationships.
db.Execute ("Delete from Table2")
db.Execute ("Delete from Table1")
db.Execute ("INSERT INTO Table1 SELECT * FROM ImportTempTable1;")
db.Execute ("INSERT INTO Table2 SELECT * FROM ImportTempTable2;")
db.Execute ("Drop Table ImportTempTable1")
db.Execute ("Drop Table ImportTempTable2")
'You must have a config table to record things like client details, db
version, whatever
DoCmd.TransferDatabase acImport, "Microsoft Access", strDBName, acTable,
"Config", "ImportTempTable1", False
db.Execute ("Delete from Config")
db.Execute ("INSERT INTO Config SELECT * FROM ImportTempTable1;")
db.Execute ("Drop Table ImportT1")
DoEvents
dbs.Close
'db.Execute ("Drop Table ImportT1")
'db.Execute ("Drop Table ImportT2")
gintResult = True
DoCmd.Close
Exit_cmdOK_Click:
DoCmd.Hourglass False
Exit Sub
Err_cmdOK_Click:
MsgBox Error$, , SYSNAME
GoTo Exit_cmdOK_Click
End Sub
-----
This is approx what I do for a runtime remote scenario and is not
comprehensive. It needs a lot of test runs. If you can visit a site with full
Access, you might just as well run the one-step process Tools, Database
Utilities, Convert Database
(I do it this way, and test it thoroughly, because there is no prospect of my
visiting remote sites. If I don't test it thoroughly, then they are down and
I'm bankrupt
However, I have stuffed it up and am apparently still in
business
) )