Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Module Not Found and Error 2507 1

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
I am trying to create a link in an external database through the following code suggested to me in a different thread.

Code:
Dim objAccess As Access.Application
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "C:\ForeignDb.mdb"
objAccess.DoCmd.TransferDatabase acLink, , CurrentDB.Name, , "Table1", "Table1"
objAccess.DoCmd.TransferDatabase acLink, , CurrentDB.Name, , "Table2", "Table2"
objAccess.Quit
Set objAccess = Nothing

When reaching this line of code
Code:
objAccess.OpenCurrentDatabase "C:\ForeignDb.mdb"

I get the following error

"Module Not Found"

I then tried creating a link to a different Database, and I got past the above line of code. What is the matter with the ForeignDb.mdb database that it is giving me this message?

Once I got through that line by creating a link to a different database. I got through to the next line of code
Code:
objAccess.DoCmd.TransferDatabase acLink, , CurrentDb.Name, , "Table1", "Table1"

and I am gettting this error
Run-time Error '2507':

The type isn't an installed database type or doesn't support the operation you chose.



 
I need some ideas how to go about this, can anyone help me please!
 
The real first question is:
are you able to do it manually ?
 
If I go into the ForeignDb.mdb and I Link to MyDb.mdb, the link works. It is when I try to create the link from Mydb.mdb with code that I am getting this error.
 
Are ForeignDb.mdb and Mydb.mdb created with the same version of access ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You may try this:
objAccess.DoCmd.TransferDatabase acLink, [!]"Microsoft Access"[/!], CurrentDb.Name, , "Table1", "Table1"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am not the creater of Foreign.mdb, I would say it is probably an earlier version. Where can I check to see which version the database was created in?
 
Thanks!

Error 2507 is gone, the "Microsoft Access" did it.
 
zevw, don't forget the pinky! [wink]

--

"If to err is human, then I must be some kind of human!" -Me
 
Sorry, I am so stupid, what do you mean by pinky, a star? You Better believe it but we still have one issue to solve.

PH Happens to never fail in his advice he is great.
 
What happens with the following ?
Dim objAccess As Access.Application
Set objAccess = CreateObject("Access.Application")
[!]objAccess.Visible = True[/!]
objAccess.OpenCurrentDatabase "C:\ForeignDb.mdb"
objAccess.DoCmd.TransferDatabase acLink, "Microsoft Access", CurrentDb.Name, , "Table1", "Table1"
objAccess.DoCmd.TransferDatabase acLink, "Microsoft Access", CurrentDB.Name, , "Table2", "Table2"
objAccess.Quit
Set objAccess = Nothing

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
zevw,

Yeah, that's what I meant. [smile]

I didn't realize there was still anything left. I guess I missed that part. [blush] It's been an interesting read for me, nonetheless.

--

"If to err is human, then I must be some kind of human!" -Me
 
PH

Tried that, still getting the error

I see the database ForeignDb.mdb opens with the menu Bar on top without the database window, and the error pops up.

Module not found

This is the description of the message when I click on Help:

Modules aren't loaded from a code reference — they must be part of the project. This error has the following cause and solution:

The requested module doesn't exist in the specified project. For example, the statement MyModule.SomeVar = 5 generates this error when MyModule isn't visible in the project MyProject.
See your host application documentation for information on including the module in the project.

 
Maybe some more info will help.

This database starts up with a whole load of code, if you don't bypass it (hold the Shift Key Down). I am thinking out loud, maybe that is the issue?

 
You may try this:
[!]Application.AutomationSecurity = msoAutomationSecurityLow[/!]
Dim objAccess As Access.Application
Set objAccess = CreateObject("Access.Application")
objAccess.Visible = True
[!]objAccess.AutomationSecurity = msoAutomationSecurityLow[/!]
objAccess.OpenCurrentDatabase "C:\ForeignDb.mdb"
[!]DoEvents[/!]
objAccess.DoCmd.TransferDatabase acLink, "Microsoft Access", CurrentDb.Name, , "Table1", "Table1"
objAccess.DoCmd.TransferDatabase acLink, "Microsoft Access", CurrentDB.Name, , "Table2", "Table2"
[!]DoEvents[/!]
objAccess.Quit
Set objAccess = Nothing

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH

Finally getting what is going on, when I run this line of code
Code:
objAccess.OpenCurrentDatabase "C:\ForeignDb.mdb"
it is trying to compile the database, I don't know if this always happens when you try to open a database through code. Basically when its compiling some of the functions don't exist Module Not Found, It really is something that the ones who wrote the code in that database will have to deal with (I even tried compiling that database and got the same error), but it is hampering my goal. So my question is how can I avoid it from compiling the database, and just simply open it so I can create the link.

Thanks for all your help :)

 
I'm sorry, but I'm afraid you have to fix the code until this DB compiles properly ...
 
Oh No! That Sucks, the company that wrote the Database is called CyberPay. I cant mess around with their code. I"m talking about a ton of modules. I can clearly see that their program was never comppiled and this is a shelfed program.

I really want to thank you for all your time and help, I have learned alot from you :)
 
One question let me ask if I try to export these tables into that database not through linking, do you think it will still give me the same error?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top