473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Cannot Define Tables after Importation from Passworded Access DB

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


Expand|Select|Wrap|Line Numbers
  1.     Dim tdf As DAO.TableDef
  2.     Dim appacc As Object
  3.     Dim db As Database
  4.     Set appacc = CreateObject("Access.Application")
  5.  
  6.     With appacc
  7.         .AutomationSecurity = 1
  8.         .OpenCurrentDatabase strLXRpthQdb, False, strPW
  9.     End With
  10.  
  11.  
  12.     i = 0
  13.  
  14. '   loop to import Questions & Text tables
  15. '   -------------------------------------------------------
  16.     Do Until (i = 2)
  17.  
  18.         i = (i + 1)
  19.  
  20.         If (i = 1) Then
  21.             strTbl = "Questions"
  22.         Else
  23.             strTbl = "Text"
  24.         End If
  25.  
  26.         For Each tdf In appacc.CurrentDb.TableDefs
  27.             If tdf.NAME = strTbl Then
  28.                 appacc.DoCmd.CopyObject strDBNpth, , acTable, tdf.NAME
  29.             Else
  30. '               ----- do nothing -----
  31.             End If
  32.         Next tdf
  33.     Loop
  34.  
  35.     appacc.CloseCurrentDatabase
  36.     Set appacc = Nothing
  37.  
  38. '   NEITHER OF THESE WORKS!!!
  39. '   -------------------------------------------------------
  40.     CurrentDb.TableDefs.Refresh
  41.     Application.RefreshDatabaseWindow
  42.  

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 'TransferDatabase' 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!
Nov 9 '12 #1
3 1308
TheSmileyCoder
2,322 Expert Mod 2GB
I am not that familiar with the process you try to implement, but can you confirm that the objects are actually copied at all to the intended destination?
Nov 9 '12 #2
Yes. Once the VBA stops it looks like the imported tables are not there. However, if I click on the queries tab (Access 2003) and then back to the tables tab, the newly imported tables show up.

They're definitely being imported, but the database just doesn't know it. It's very frustrating.

Hope you can help.

Thanks.
Nov 9 '12 #3
TheSmileyCoder
2,322 Expert Mod 2GB
I see.

The question is if its merely a display problem or a functional problem. Can you work with the imported objects through code?

Or is the problem more that you want the display to be updated immediately? You haven't really described what the main purpose is, i.e. what should happen after the import.
Nov 9 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jackson | last post by:
I'm having a problem with some .DBF tables and Access 2002. When I try to link them as external data, Access reports "External table is not in expected format", help says the table has changed...
0
by: Zlatko Matić | last post by:
I tried to work with postgres temporary tables from MS Access, but unsuccessfully... I was able to create temporary table by pass-through query, also I succeeded in creating linked table through...
3
by: davidanthonyedwards | last post by:
Please Help, I have been given an Access application to have a look at, am newbie, etc. When I open the mdb file with the shift key down so that the menu options are available I can see all the...
0
by: asorkoram | last post by:
Hello, I have a 3rd party app that uses SQL server to store its data. I am also creating a MS Access 2003 app to access the data. When I import the tables a few of the tables have over the 32 index...
0
by: asorkoram | last post by:
Hello, I have a 3rd party app that uses SQL server to store its data. I am also creating a MS Access 2003 app to access the data. When I import the tables a few of the tables have over the 32 index...
1
by: thomasma57 | last post by:
How do you connect an ADO control to a MS Access database that has a password. I am using Jet.OLEBD.
7
by: kalkotarmr | last post by:
How to Create Dynamic Tables in MS-Access? I will just pass the Arguments and the Code will Create the tables dynamically/run-time.
3
mafaisal
by: mafaisal | last post by:
End of parameter list expected. Cannot define parameters after a paramarray parameter. Public Sub F_Bind(ByVal StrSql As String, ByVal ParamArray Ctrls() As Object,Optional ByVal Row as Integer...
7
by: Gary | last post by:
Hello guys! Bear with me, I am a newbie. She is the Data Warehouse manager. She has about 50 users to use the Oracle database from M$ Access via ODBC connection. All those users have only...
7
by: 07465435 | last post by:
Hi i am very stuck there. I am trying to create an vb.net program to transfer or copy tables from my access database to an MSSQL DB. I got it working to copy from MSSQL to access but not the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.