Question

DllRegisterServer entry point was not found

Asked by: AviationAce

I am trying to put a collection of functions that I use a lot in a DLL to be used in Access 2007 and Excel 2007.

The entire code for a test DLL project is listed below.

I tried using this command: regsvr32 Test1.dll
I got this error message : Test1.dll was loaded, but DllRegisterServer entry point was not found.  This file connot be registered.

I tried declaring it like this inside Access 2007:
Declare Function fnSR Lib _
        "C:\Documents and Settings\userA\My Documents\Visual Studio 2008\Projects\Test1\Test1\bin\Release\Test1.dll" _
        Alias "fnSqrt" (ByVal dDblIn As Double) _
        As Double

From the immediate window I type: ? fnSR(9)
I get run-time error 453: Can't find DLL entry point fnSR in C:\Documents and Settings\userA\My Documents\Visual Studio 2008\Projects\Test1\Test1\bin\Release\Test1.dll

Info on my the VB I am using:
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: VB Express

Microsoft Visual Basic 2008   91908-152-0000043-60625
Microsoft Visual Basic 2008

So, how can I get this function to work inside Access 2007?

Thanks!

Public Class TestClass1
    Public Sub New()
        Debug.Print("TestClass1 Init!")
    End Sub
 
    Public Function fnSqrt(ByVal dDblIn As Double) As Double
        Return System.Math.Sqrt(dDblIn)
    End Function
End Class

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-28 at 12:05:13ID24607319
Tags

VB

,

VBA

,

DLL

,

Office 2007

,

Access 2007

,

Excel 2007

Topics

Microsoft Visual Studio Express

,

Microsoft Visual Basic.Net

,

ActiveX

Participating Experts
2
Points
250
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Regsvr32
    I have some activex control projects I've compiled to ocx's but that's all. I've noticed that somehow, these are showing up in the projec's components window (three entries all called project1). I would like to remove them and was wondering if there's a way to do it from with...
  2. VB.NET RegSvr32
    I have a program that basically installs a bunch of files that sit on a Server onto the user's local machine. These files include .dlls and ocx files that are used by an VB 6 Application and they must be registered on the local machine. The issue is with a user who doesn't h...
  3. When to use Regsvr32
    I recently found an issue at my job and the fix was to copy a new version of a dll specifically shdocvw.dll over an old one in system32. I do not have to do a regsvr32 for the fix to work, just to copy over it, but my question is WHEN do i HAVE to use regsvr32. Only if it is...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: HBHoffmanPosted on 2009-07-29 at 11:30:37ID: 24973082

You need to use Regasm.exe to register your .Net dll.

 

by: AviationAcePosted on 2009-07-30 at 08:49:46ID: 24981052

'Regasm.exe' is not recognized as an internal or external command,
operable program or batch file.

Where do I get this program?

 

by: AviationAcePosted on 2009-07-30 at 09:06:01ID: 24981235

OK. I found the Regasm program as ran ths command:
Regasm Test1.dll


Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.3053
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.
Types registered successfully

How does this help me use this DLL in Access now?

Thanks.

 

by: HBHoffmanPosted on 2009-07-30 at 09:37:22ID: 24981629

The dll is now registered, you should be able to reference it in your Access program.

 

by: AviationAcePosted on 2009-07-30 at 10:28:05ID: 24982193

When I go to Access and try to add it as a reference, I don't see it on the list.

 

by: HBHoffmanPosted on 2009-07-30 at 10:54:51ID: 24982527

You'll probably need to navigate to it add add it that way.

 

by: AviationAcePosted on 2009-07-30 at 11:25:41ID: 24982875

I'll try that.  However, check this out.

I noticed that TestClass1 attributes COM Class and COM Visible needed to be set to true.  After I did that it chaged my source code.  Notice "
<Microsoft.VisualBasic.ComClass()>" added in front of the class declaration.  I now get a warning:

'Microsoft.VisualBasic.ComClassAttribute' is specified for class '<classname>' but it has no public members that can be exposed to COM; therefore no COM interfaces are generated

<Microsoft.VisualBasic.ComClass()> Public Class TestClass1
    Public Sub New()
        Debug.Print("TestClass1 Init!")
    End Sub
 
    Public Shared Function fnSqrt(ByVal dDblIn As Double) As Double
        Return System.Math.Sqrt(dDblIn)
    End Function
End Class
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:

Select allOpen in new window

 

by: AviationAcePosted on 2009-07-30 at 11:35:46ID: 24982992

Set COM Visable to True for the function as well.

<Microsoft.VisualBasic.ComClass()> Public Class TestClass1
    Public Sub New()
        Debug.Print("TestClass1 Init!")
    End Sub
 
    <System.Runtime.InteropServices.DispId(1)> _
    Public Shared Function fnSqrt(ByVal dDblIn As Double) As Double
        Return System.Math.Sqrt(dDblIn)
    End Function
End Class
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

Select allOpen in new window

 

by: AviationAcePosted on 2009-07-31 at 08:45:50ID: 24989886

Navigating to the DLL dosen't help.

 

by: CodeCruiserPosted on 2009-08-03 at 08:54:03ID: 25005531

I think regasm registers a .NET assembly into GAC. Now that you have added the COM related attributes, you should be able to use the regsvr32.

 

by: AviationAcePosted on 2009-08-03 at 09:49:06ID: 25006160

I tried regsvr32 again and got the same error message as before:

Test1.dll was loaded, but DllRegisterServer entry point was not found.  This file connot be registered.

 

by: HBHoffmanPosted on 2009-08-03 at 09:58:17ID: 25006247

 

by: AviationAcePosted on 2009-08-05 at 08:41:26ID: 25024714

OK.  Making progress.

Now when I goto MS Access I can find the Test1 library to reference and use in VBA.  The attached code is function I wrote in VBA in a Access module.  It runs with out error.  However, as you can see it does a whole lot of nothing.

The problem is: the fnSqrt function is NOT visible.  How do I declare that function to make it visible?

************* Function call to DLL in VBA ****************
Function TestTest1() As Double
Dim T1 As New TestClass1
 
Set T1 = Nothing
End Function
 
*********** Source code for DLL in VB *****************
*********** Microsoft Visual Basic 2008 Express Edition
Microsoft.VisualBasic.ComClass()> Public Class TestClass1
    Public Sub New()
        Debug.Print("TestClass1 New!")
    End Sub
 
    <System.Runtime.InteropServices.DispId(1)> Public Shared Function fnSqrt(ByVal dDblIn As Double) As Double
        Return System.Math.Sqrt(dDblIn)
    End Function
 
    Protected Overrides Sub Finalize()
        Debug.Print("TestClass1 Finalize!")
        MyBase.Finalize()
    End Sub
End Class
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Select allOpen in new window

 

by: CodeCruiserPosted on 2009-08-05 at 08:44:51ID: 25024759

Use the <COMVisible(True)> _ attribute on the function.

 

by: AviationAcePosted on 2009-08-05 at 10:01:53ID: 25025533

Already had done that.  <COM Visable =True>  <DispId = True>  <Value = 1>

 

by: AviationAcePosted on 2009-08-06 at 12:07:08ID: 25036944

Making more progress!  Using some examples I've come up with what you see below.  Now the fnSqrt function IS visible in MS Access.

I use this to rigister the DLL:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe Test1.dll /tlb:Test1.tlb /verbose

After that I see 'Test1' can be added as a reference in MS Access.

Here is my function in MS Access:
Function TestTest1() As Double
Dim T1 As New TestClass1
Debug.Print T1.fnSqrt(9)
Set T1 = Nothing
End Function

From the immediate widow I try to run the function:
? TestTest1()

An error message box pops up now:
Run-time error '-2147024894 (800700002)':
Automation error
The system cannot fine the file specified.

<ComClass(TestClass1.ClassID, TestClass1.InterfaceId, TestClass1.EventsId)> _
Public Class TestClass1
#Region "COM GUIDs"
    Public Const ClassID As String = "6DEE5FE7-06CA-4d1d-99E0-C3CFE6C8B3FE"
    Public Const InterfaceId As String = "94BA3D27-2F38-4973-BB61-2126888227A4"
    Public Const EventsId As String = "C8A41666-0EF4-4729-9D1E-A3E2A1893CDF"
#End Region
 
    Public Sub New()
        MyBase.New()
        MsgBox("New TestClass1", MsgBoxStyle.Information, "TestClass1")
    End Sub
 
    <System.Runtime.InteropServices.DispId(1)> _
    Public Function fnSqrt(ByVal dDblIn As Double) As Double
        Return System.Math.Sqrt(dDblIn)
    End Function
End Class
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:

Select allOpen in new window

 

by: AviationAcePosted on 2009-08-06 at 12:55:32ID: 25037443

Progress in VB.  I made a new VB console project.  I included a reference to the Test1.tlb  file.  It works!

So, why does it work in VB and not in VBA in MS Access?

Module Module1
    Sub Main()
        Console.WriteLine(("Test DLL"))
        Console.WriteLine((Test1.TestClass1.fnSqrt(9)))
        Console.ReadLine()
    End Sub
 
End Module

                                              
1:
2:
3:
4:
5:
6:
7:
8:

Select allOpen in new window

 

by: CodeCruiserPosted on 2009-08-07 at 00:43:43ID: 25040570

There could be many problems including the difference in datatypes being used. I dont think Double is a type in MSAccess!

 

by: AviationAcePosted on 2009-08-07 at 06:25:26ID: 25042385

I found this on another web site.

http://www.developmentnow.com/g/21_2008_3_0_0_1050252/Problem-using-Net-2-0-assembly-with-com-client.htm

"Actually, I ended up using the /codebase option with the regasm, and it
started working! I got this help in another forum.

This worked even though I hadn't given the DLL a strongname. There is a
warning when I use regasm that if the DLL doesn't have a strongname it could
interfere with others on the computer; for my particular case this is not a
problem as I will always ever use this one version ONLY (and hopefully will
before too long be replacing the entire VB6 app, so this is a temporary
measure. But there are few temporaries in the world of released software....)

Also, as far as I know you need to unregister and reregister the DLL every
time there's a change, even if the interface doesn't change. Again, this is
not a problem in our case; the batch files to register unregister seem to
work very reliably.

Hope this works for others as well."


</EM> I added the code base switch when I call regAsm:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe Test1.dll /tlb:Test1.tlb /verbose /codebase

I WORKS in MS Access now!

I guess the last thing to know is how do I give my DLL a "strong name"

Here is the warning from RegAsm:
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully

 

by: CodeCruiserPosted on 2009-08-07 at 06:38:59ID: 25042527

You can do that in project properties and Signing tab.

 

by: AviationAcePosted on 2009-08-07 at 06:49:13ID: 31608904

Thanks for all the help.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...