Solved

Help adding .dll file to MS access

Posted on 2011-02-18
11
547 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

839 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