Refresh tables code


D

Doc

Hey - I'm fairly new to programming, and I've written this code to simply
refresh the ODBC and Access BE tables I have in my database. Can anyone see
anything wrong with it? It works fine, but almost seems to simple.


'Refresh Tables Code Start
Function RefreshTables()
On Error GoTo ErrHand
Dim db As Object, tdf As Object, i As Integer
Dim tdfCount As Integer, tdfCur As Integer

tdfCount = CurrentDb.TableDefs.Count
tdfCur = tdfCount

ProgressBarInit "Refreshing the server links, please wait"

For i = 0 To CurrentDb.TableDefs.Count - 1
Set db = CurrentDb
Set tdf = db.TableDefs(i)
If tdf.Connect <> "" Then
tdf.RefreshLink
End If
tdfCur = tdfCur - 1
ProgressBar tdfCount, tdfCur
Next i

If IsFormLoaded("frmProgressBar") Then DoCmd.Close acForm,
"frmProgressBar"

Exit Function

ErrHand:
ErrorLog "MFunc", "modMFunc", "eFn-134", Screen.ActiveForm.Name,
Screen.ActiveControl, Err.Number, Err.Description
End Function
'Refresh Tables Code End


Thanks!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top