In my MS Access VBA sub-routine, after having identified an external database as having a password, by database retrieves the password from a table before importing the Questions and Text tables from that external database.
The following variables are assigned before the code is executed:
strLXRpthQdb = Name & Path of External Database
strPW = External Database's Password
As indicated in the VBA notes, neither of the following 'refresh' procedures works.
As a result, I can't do anything with the tables I've just imported. Importing via regular 'TransferDataba se' seems to automatically refresh the table definitions. I've tried inserting 'db = CurrentDb' as I've seen suggested, but still no dice.
ANY suggestions would be appreciated!
Thanks!
The following variables are assigned before the code is executed:
strLXRpthQdb = Name & Path of External Database
strPW = External Database's Password
Code:
Dim tdf As DAO.TableDef Dim appacc As Object Dim db As Database Set appacc = CreateObject("Access.Application") With appacc .AutomationSecurity = 1 .OpenCurrentDatabase strLXRpthQdb, False, strPW End With i = 0 ' loop to import Questions & Text tables ' ------------------------------------------------------- Do Until (i = 2) i = (i + 1) If (i = 1) Then strTbl = "Questions" Else strTbl = "Text" End If For Each tdf In appacc.CurrentDb.TableDefs If tdf.NAME = strTbl Then appacc.DoCmd.CopyObject strDBNpth, , acTable, tdf.NAME Else ' ----- do nothing ----- End If Next tdf Loop appacc.CloseCurrentDatabase Set appacc = Nothing ' NEITHER OF THESE WORKS!!! ' ------------------------------------------------------- CurrentDb.TableDefs.Refresh Application.RefreshDatabaseWindow
As indicated in the VBA notes, neither of the following 'refresh' procedures works.
As a result, I can't do anything with the tables I've just imported. Importing via regular 'TransferDataba se' seems to automatically refresh the table definitions. I've tried inserting 'db = CurrentDb' as I've seen suggested, but still no dice.
ANY suggestions would be appreciated!
Thanks!
Comment