bob bisquick
Registered User.
- Local time
- Today, 15:09
- Joined
- Nov 8, 2002
- Messages
- 37
I have created a public function:
Public Function LinkTables(tblName, path As String)
On Error GoTo LinkTheTable
DoCmd.SelectObject acTable, tblName, True
DoCmd.DeleteObject acTable, tblName
GoTo LinkTheTable
LinkTheTable:
DoCmd.TransferDatabase acLink, "Microsoft Access", path, acTable, _
tblName, tblName
End Function
This function links to tables in a database I specify when it is called. If I place this function in the code of my form, it works fine. If I plce this function in a module, it links the tables fine, but does not delete the older instances of those tables (the DeleteObject statement). Why is this happening?
Public Function LinkTables(tblName, path As String)
On Error GoTo LinkTheTable
DoCmd.SelectObject acTable, tblName, True
DoCmd.DeleteObject acTable, tblName
GoTo LinkTheTable
LinkTheTable:
DoCmd.TransferDatabase acLink, "Microsoft Access", path, acTable, _
tblName, tblName
End Function
This function links to tables in a database I specify when it is called. If I place this function in the code of my form, it works fine. If I plce this function in a module, it links the tables fine, but does not delete the older instances of those tables (the DeleteObject statement). Why is this happening?