P
pietlinden
I have a database that I'm supposed to update to eliminate the use of
confidential patient information. Because I need to mess with
Autonumbers, I exported the empty tables to another database with this
code:
Public Sub ExportStructure(ByVal strDestinationDB As String)
'R:\G drive\IIT Databases\OUTCOMES\Outcom01 GIST\SCRI Outcomes
NEW.mdb"
'Dim db As DAO.Database
Dim tdf As DAO.TableDef
For Each tdf In DBEngine(0)(0).TableDefs
'export the structure to another database.
If Left$(tdf.Name, 4) <> "MSys" Then
Debug.Print "Exporting " & tdf.Name & "..."
DoCmd.TransferDatabase acExport, "Microsoft Access",
strDestinationDB, acTable, tdf.Name, tdf.Name, True
Debug.Print tdf.Name & " exported to " & strDestinationDB
End If
Next tdf
End Sub
What baffles me is that somehow the relationships get copied over.
But if I add the tables to the relationships window, none of the
relationships show up. but if I try to run an import, it gripes about
RI violations. Do I need to do something more severe like loop
through the relation[ship]s collection and delete them all? and then I
have a database with the relationships/RI constraints really dropped?
I'm about expecting MS to ask for my CC# so that the relationships
will really be deleted... WTF?
Thanks,
Pieter
confidential patient information. Because I need to mess with
Autonumbers, I exported the empty tables to another database with this
code:
Public Sub ExportStructure(ByVal strDestinationDB As String)
'R:\G drive\IIT Databases\OUTCOMES\Outcom01 GIST\SCRI Outcomes
NEW.mdb"
'Dim db As DAO.Database
Dim tdf As DAO.TableDef
For Each tdf In DBEngine(0)(0).TableDefs
'export the structure to another database.
If Left$(tdf.Name, 4) <> "MSys" Then
Debug.Print "Exporting " & tdf.Name & "..."
DoCmd.TransferDatabase acExport, "Microsoft Access",
strDestinationDB, acTable, tdf.Name, tdf.Name, True
Debug.Print tdf.Name & " exported to " & strDestinationDB
End If
Next tdf
End Sub
What baffles me is that somehow the relationships get copied over.
But if I add the tables to the relationships window, none of the
relationships show up. but if I try to run an import, it gripes about
RI violations. Do I need to do something more severe like loop
through the relation[ship]s collection and delete them all? and then I
have a database with the relationships/RI constraints really dropped?
I'm about expecting MS to ask for my CC# so that the relationships
will really be deleted... WTF?
Thanks,
Pieter