Modify Connect Propety

T

Turner

The following code modifies the Connect Property of the
TableDef. When the next form opens its fields are blank
(Bad), however if I click anywhere off the form and then
reclick on the form the data appears (good). Well sort
of. I must be missing something! I just don't know what!
Any help would be appreciated!!!

Public Function ResetLink()
On Error GoTo err_ResetLink

Dim db As Database
Dim tdf As TableDef
Dim stPath As String

stPath = DLookup("ServerPath", "zSystem")
stPath = stPath & "\" & DLookup
("ServerData", "zSystem")
'*********************************************
' Local File Not Available Connect to Server
'*********************************************
Set db = CurrentDb
Set tdf = db.TableDefs("dUd_Auditors")
tdf.Connect = ";Database=" & stPath
& ";TABLE=dUd_Auditors"
tdf.RefreshLink

Set tdf = db.TableDefs("hDv_Division")
tdf.Connect = ";Database=" & stPath
& ";TABLE=hDv_Division"
tdf.RefreshLink

db.TableDefs.Refresh

exit_ResetLink:
Set db = Nothing
Exit Function

err_ResetLink:

MsgBox Err.Description
MsgBox Err.number
Resume exit_ResetLink

End Function
 

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