C
Carol Grismore
I have an Access 2002 database that just keeps growing, and no amount of
repairing and compacting will fix it.
The trouble started when I put in some code. It's pretty simple; all it
does is reconnect all the tables linked to our Sybase databases. We have
development, test and production versions of the same Sybase database, and
it's handy to be able to switch back and forth between these using this code:
----------------------------
Sub AutoReconnect()
Dim db As Object
Dim tdf As Object
Dim cnt As String
Dim X As Integer
Dim rtn As Integer
rtn = SysCmd(acSysCmdSetStatus, "Reconnecting database objects...")
Set db = CurrentDb
For X = 0 To db.TableDefs.Count - 1
Set tdf = db.TableDefs(X)
cnt = tdf.Connect
' Already connected to the requested Sybase database.
strCurrent = Mid(cnt, 10, 6)
If strCurrent = strDSN Or strCurrent = (strDSN & ";") Then Exit Sub
' Refresh all connections.
If tdf.name Like "dbo_*" Then
cnt = "ODBC;DSN=" & UCase(strDSN) & ";SRVR=GRANT;DB=" &
LCase(strDSN) & ";"
tdf.Connect = cnt
tdf.RefreshLink
End If
Next X
End Sub
----------------------------
I am wondering if I have forgotten to do something that is causing Access to
grow so alarmingly. The particular database I'm referring to started out at
21 MB and is now 51 MB. The only thing we've really done in it is exercise
the code above.
Thanks in advance for your help.
Warmest regards,
Carol
repairing and compacting will fix it.
The trouble started when I put in some code. It's pretty simple; all it
does is reconnect all the tables linked to our Sybase databases. We have
development, test and production versions of the same Sybase database, and
it's handy to be able to switch back and forth between these using this code:
----------------------------
Sub AutoReconnect()
Dim db As Object
Dim tdf As Object
Dim cnt As String
Dim X As Integer
Dim rtn As Integer
rtn = SysCmd(acSysCmdSetStatus, "Reconnecting database objects...")
Set db = CurrentDb
For X = 0 To db.TableDefs.Count - 1
Set tdf = db.TableDefs(X)
cnt = tdf.Connect
' Already connected to the requested Sybase database.
strCurrent = Mid(cnt, 10, 6)
If strCurrent = strDSN Or strCurrent = (strDSN & ";") Then Exit Sub
' Refresh all connections.
If tdf.name Like "dbo_*" Then
cnt = "ODBC;DSN=" & UCase(strDSN) & ";SRVR=GRANT;DB=" &
LCase(strDSN) & ";"
tdf.Connect = cnt
tdf.RefreshLink
End If
Next X
End Sub
----------------------------
I am wondering if I have forgotten to do something that is causing Access to
grow so alarmingly. The particular database I'm referring to started out at
21 MB and is now 51 MB. The only thing we've really done in it is exercise
the code above.
Thanks in advance for your help.
Warmest regards,
Carol