We help IT Professionals succeed at work.

Import access db objects into blank database

I have code in databases that exports all the objects and it does this successfully.  Now, I need to re-import these objects into a blank database.  I have done this before (OK, I don't know where I put the code!) so I know it works.  But I cannot get this test code to bring in the data.  I keep getting the error message: 2487 The Object Type argument for the action or method is blank or invalid.  But all arguments are populated.  The path is correct and tables names are correct.
Public Sub ImportDatabaseObjects()
On Error GoTo ErrorHander

'Import tables
Application.LoadFromText acTable, "t_lu_category", s_SYBASELinkPath & "Table_t_lu_category.txt"
Debug.Print s_SYBASELinkPath


MsgBox "All database objects have been exported as a text file to " & s_SYBASELinkPath, vbInformation

Exit_ErrorHandler:
    Exit Sub
    
ErrorHander:
    MsgBox Err.Number & "Description: " & Err.Description
    Resume Exit_ErrorHandler
End Sub

Open in new window

Comment
Watch Question

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Where is s_SYBASELinkPath defined ?

mx

Commented:
Do you want all objects or just Tables?
Sandra SmithRetired

Author

Commented:
s_SYBASELinkPath is a contstant declared at the top of the module and it is being passed.  I am testing brining in just one table for now to get the code to work.  Once that does, I will add all the objects to the import module.  I know this works and I remember the first time I did this, I had the same problem.  But again, I can't find the code that I finally got to work.  
Sandra SmithRetired

Author

Commented:
s_SYBASELinkPath is a contstant declared at the top of the module and it is being passed.  I am testing brining in just one table for now to get the code to work.  Once that does, I will add all the objects to the import module.  I know this works and I remember the first time I did this, I had the same problem.  But again, I can't find the code that I finally got to work.  
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
I'm not seeing a LoadFromText method for the Application object ... ?

mx
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
ok ... it's a hidden method ...

mx
Sandra SmithRetired

Author

Commented:
Since the tables are being loaded from a text file, could I be using the wrong import method?  Also, my system is acting weird so I apologize if comments show up twice.
Database Architect / Application Developer
Top Expert 2007
Commented:
What about

DoCmd.TransferText

instead ?

mx
Sandra SmithRetired

Author

Commented:
That was it.  Thank you.
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Just a side note: TransferText will build a Table based on a Text file. You were using LoadFromText (and undocumented feature of Access) which is used by some processes (specifically SourceSafe) to move objects into a database container. Not that it matters - you got your issue resolved - but I thought it needed a bit of clearing.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
"(and undocumented feature of Access)"

Not sure it's really undocumented.  If, you go to the object browser, right click and select Show Hidden Members, you see it.  Guess I've always wondered what Hidden Members are?

mx
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
I'm aware of the listing in the Object Browser, but apparently my definition of "undocumented" is different from yours :)

I have never seen an documentation on MSDN, help or any other Microsoft-supported site which details any sort of "official" use, which is why I used that term. I could have simply missed it, of course, but I searched again and couldn't find it. To my mind, a documented feature would have a help file entry and perhaps some explanation of usage, with examples.

But that's just my .02 worth ...
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Well, I wasn't questioning the definition ... more, I was just wondering what those Hidden Members actually are?  Do you know ?  Or are those considered 'undocumented' ?

mx

Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
I don't think anybody outside of Redmond really knows ;)

Just a cursory review shows that some are obviously there for legacy support, some are there for use by the Wizards, and others are ... well, there's just no way to tell! It's fascinating (to me, anyway) to see what they all do.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Hey ... we can ask the MS team next Feb !!

mx
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Assuming we are re-upped, that is!
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
Yeah ... speaking of which ... there are a lot of MVP's on the list that I find hard to believe that are doing much these days.
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Yeah, some of the older MVPs haven't taken too well to these new-fangled web forums ;)

Seriously, I'm thinking they'll thin the herd this year and next. I've been spending a good bit of time over at the enemy camp (UA) and don't see a tremendous amount of participation over there. They field about 1/3 of the questions there that we do over here (if that many), it seems.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
I really can't stand the UA UI ... antiquated, 'threaded' forum format.  EE has a 10x better UI.

mx
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Have you seen the new one? Much better than the old, although EE's is far better.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
Top Expert 2007

Commented:
I have yes ... slightly better.

mx