• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Issue in Importing datatabse

Ajay Verma

New Member
Hi All

I am importing a database into another blank database below is the code m using
Code:
Sub makedb()
  Dim accessApp As Access.Application
  Set accessApp = New Access.Application
  accessApp.DBEngine.CreateDatabase "D:\tblImport.accdb", DB_LANG_GENERAL
  DoCmd.TransferDatabase acImport, "Microsoft Access", _
  "C:\WMDokInt_80_01_32Bit.accdb", acTable, "datLogo", _
  "datLogo", False
 End Sub
It give me 2046 error(the command or action TransferDatabase isn't available now)

Can anyone please help?

Mod Edit: Code tags added
 
Last edited by a moderator:
It's Access VBA and not Excel right? Error 2046, is one of the more tricky one.

Couple of things you can try.
1. Check and make sure database is not set to read-only
2. Make sure the type of object and action applies to is currently selected and/or active in the view

But you may get better answer from Access Forums.
http://www.accessforums.net/
 
Thnx Chihiro, how could i make sure database is not set to read-only?

The whole process is i have to import a DB in that i have particular table, i have to select that table and export it to xml file, but i m getting issue in importing the DB.
 
Access has few VBA limitations. Normally you'd not want to import from external control as it will likely infringe on point #2 in my post.

Rather, import into Access from Access side to avoid issue. To check that DB is not set to read-only check on Access side as well.

Edit: I don't often work with xml. See link for process on importing and exporting xml from Access.
https://technet.microsoft.com/en-us/library/ee692914.aspx
 
Back
Top