Solved

Help adding .dll file to MS access

Posted on 2011-02-18
11
543 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

757 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

17 Experts available now in Live!

Get 1:1 Help Now