Hi All,
As part of my strategy to upgrade clients back ends which involves matching version numbers, copying tables to BE, running queries etc I have a piece of code whereby I need to delete 3 tables from their BE's (these tables are causing relationship conflicts). The following code works fine on my pc but didn't work on my laptop until I added the full path at the Set DB = "..the path etc" (originally I just had the BE file name and it worked on pc) Anyway changing this line to the full path of the BE made it work on the laptop. Cool, or so I thought! Now, having sent the upgrade to a client its mucking up again
Heres the code:
Dim DB As DAO.Database, i As Integer
Set DB = OpenDatabase("C:\Program Files\VinRec\VADataFile.mdb")
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Vintage") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Harvest Data") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Pruning") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
DB.TableDefs.Delete ("Vintage")
DB.TableDefs.Delete ("Pruning")
DB.TableDefs.Delete ("Harvest Data")
Set DB = CurrentDb
I hope someone can enlighten me as to what is going wrong, it seems very fickle.
Thankyou, Rachael
As part of my strategy to upgrade clients back ends which involves matching version numbers, copying tables to BE, running queries etc I have a piece of code whereby I need to delete 3 tables from their BE's (these tables are causing relationship conflicts). The following code works fine on my pc but didn't work on my laptop until I added the full path at the Set DB = "..the path etc" (originally I just had the BE file name and it worked on pc) Anyway changing this line to the full path of the BE made it work on the laptop. Cool, or so I thought! Now, having sent the upgrade to a client its mucking up again
Heres the code:
Dim DB As DAO.Database, i As Integer
Set DB = OpenDatabase("C:\Program Files\VinRec\VADataFile.mdb")
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Vintage") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Harvest Data") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
For i = DB.Relations.Count - 1 To 0 Step -1
If (DB.Relations(i).Table = "Pruning") Then
DB.Relations.Delete (DB.Relations(i).Name)
End If
Next i
DB.TableDefs.Delete ("Vintage")
DB.TableDefs.Delete ("Pruning")
DB.TableDefs.Delete ("Harvest Data")
Set DB = CurrentDb
I hope someone can enlighten me as to what is going wrong, it seems very fickle.
Thankyou, Rachael