Solved

Help adding .dll file to MS access

Posted on 2011-02-18
11
544 Views
Last Modified: 2012-05-11
Hi,

I was wondering if someone can help.
I have created a custom .dll file for an application using visual studio 2008 and am trying to add this into a Microsoft access project.

The version of access is 2003. I have tried going to the code window clicking on tools-->references and browsing to the .dll file.
I then receive the following message “Can’t add reference to the specified file”  

All of these .dll files add fine to visual studio but I need to be able to use this in a Microsoft access application. Any help would be appreciated.

Regards,

Ross

Screens.docx
0
Comment
Question by:ross13
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 57
ID: 34928163
Ross,

  I've never written a .DLL for Access, but I know that some need to be registered with Regsrv32 before they can be used.  Only a native .DLL can be used without registering.

JimD.

0
 
LVL 75
ID: 34928213
"Only a native .DLL can be used without registering."
Not sure what you mean by 'native', but the Lebans Mousewheel Hook DLL for example does not need to be registered, as well as a couple of others.

mx
0
 
LVL 57
ID: 34928264

  It's may understanding that "native" means that its been compiled for use with a specific chip. I've heard other definitions as well, but that seems to be the main one.  Since I've only written one DLL in my life, I don't claim to be an Expert.  All I know is that there is a difference.

  Some need to be registered and some do not.  As you pointed out, Leban's mousehook DLL does not, while vbSendMail.DLL does.

JimD.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 57
ID: 34928306

  Actually, I think in terms of DLL's, it has something to do with the interface that it presents and how that gets exposed to the calling program.

JimD.
0
 
LVL 75
ID: 34928321
" ....and how that gets exposed to the calling program."
Yes ... that sounds more like what the issue might be ...

mx
0
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 34928731
You need to create type library and add the type library as a reference

Project Properties > Compile Tab > Register for COM interop

OR

Type Library Exporter (Tlbexp.exe)
http://msdn.microsoft.com/en-us/library/hfzzah2c(v=vs.80).aspx
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 500 total points
ID: 34928764
My bad wrong reference should be:

Assembly Registration Tool (Regasm.exe)
http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.71).aspx
0
 

Author Comment

by:ross13
ID: 34932898
I received the following message after i tried that.

Warning      2      "C:\Documents and Settings\RRobertson\My Documents\Visual Studio 2008\Projects\fsc_runningTotal\fsc_runningTotal\bin\Release\fsc_runningTotal.dll" does not contain any types that can be registered for COM Interop.      fsc_runningTotal
0
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 500 total points
ID: 34932939
Did you mark it as COM Visible? Projects properties > Application Tab > Assembly Information button > select "Make assesmbly COM visible"
0
 

Author Comment

by:ross13
ID: 34933408
Yeah.
I tried a build --> rebuild and i get the warning message reported above.
If i just hit build the warning goes away.
I tried going into the access application after doing this in visual studio and browsing and selecting the .dll and i still get the error message “Can’t add reference to the specified file”  
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 500 total points
ID: 34933559
You don't select the DLL you have to add the .TLB file as the reference. The DLL is a NET assembly not a COM object ;)

Look in your Bin folder for the .tlb file
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now