[AccessD] DAO350.dll error

Darryl Collins Darryl.Collins at coles.com.au
Wed Mar 5 21:11:17 CST 2008



Hey Keith,

That damn file was the bane of my life a couple of weeks back.  If you can get into the registry try this

'------------------------------------------------------------------------------------

1. Click Start, and then click Run. 
2. In the Open box, type regsvr.exe. 
3. Re-register DAO350.dll.

NOTE: You can obtain a copy of DAO350.dll at the following FTP address:
ftp://ftp.microsoft.com/softlib/mslfiles/ 
To register DAO350.dll, follow these steps:

a.  Click Start, and then click Run. 
b.  In the Open box, type Regsvr32.exe C:\progra~1\common~1\micros~1\dao\dao350.dll 
c.  Click OK. 
 

' ----------------------------------------------------------------------------


If like me you cannot get access to the registry I found the code below that worked around this for me.
Actually, I am still grateful for this bit of code - really did save my butt! (watch for wrap out of the email).

'-----------------------------------------------------------------------------------------------------------------------
Option Compare Database
Option Explicit

'http://www.trigeminal.com/usenet/usenet026.asp
'http://www.trigeminal.com/code/RegisterDao.bas

Private Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_QUERY_VALUE = &H1
Public Const ERROR_SUCCESS = 0&
Public Const MAX_PATH = 260
Public Const S_OK = &H0

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long

Private Declare Function RegDaoDll Lib "dao360.dll" Alias "DllRegisterServer" () As Long

Private Const REGKEY As String = "SOFTWARE\Microsoft\Windows\CurrentVersion"
Private Const REGVAL As String = "CommonFilesDir"
Private Const DLLLOCATION As String = "\Microsoft Shared\DAO\dao360.dll"

Public Function DaoReg() As Boolean
Dim hKey As Long
Dim stName As String
Dim cb As Long
Dim hMod As Long
    ' First, find DAO. Ordinarily we could call the shell32/shfolder
    ' functions to find the location of the "Common Files" folder,
    ' but this will not work on Windows 95. So, go right to the
    ' registry to find:
    '   $(PROGRAM FILES)\$(COMMON FILES)\Microsoft Shared\DAO
    
    If (ERROR_SUCCESS = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY, 0, KEY_QUERY_VALUE, hKey)) Then
        cb = MAX_PATH
        stName = String$(cb, vbNullChar)
                
        If (ERROR_SUCCESS = RegQueryValueEx(hKey, REGVAL, 0&, ByVal 0&, ByVal stName, cb)) Then
            ' Ok, now build the full DLL path
            stName = StFromSz(stName) & DLLLOCATION
            
            ' Load DAO so we can try to register it
            hMod = LoadLibrary(stName)
            If hMod Then
                ' Find out if the registration works
                DaoReg = (RegDaoDll() = S_OK)
                
                Call FreeLibrary(hMod)
            End If
        End If
        Call RegCloseKey(hKey)
    End If
End Function

'------------------------------------------------------------
'   StFromSz
'
'    Find the first vbNullChar in a string, and return
'    everything prior to that character. Extremely
'    useful when combined with the Windows API function calls.
'------------------------------------------------------------
Public Function StFromSz(ByVal sz As String) As String
    
    Dim ich As Integer
    
    ich = InStr(sz, vbNullChar)
    Select Case ich
        ' It's best to put the most likely case first.
        Case Is > 1
            ' Found in the string, so return the portion
            ' up to the null character.
            StFromSz = Left$(sz, ich - 1)
        Case 0
            ' Not found at all, so just
            ' return the original value.
            StFromSz = sz
        Case 1
            ' Found at the first position, so return an empty string.
            StFromSz = vbNullString
    End Select
End Function

'-----------------------------------------------------------------------------------------------------------



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Keith
Williamson
Sent: Thursday, 6 March 2008 1:54 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] DAO350.dll error


Hey guys,

After years of using this application, suddenly I am getting an error:

"Your project contains a missing or broken reference to the file DAO350.dll"

Any ideas on what gives??

Thanks,

Keith Williamson





-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses.  No warranty is made that this material is free from computer virus or any other defect or error.  Any loss/damage incurred by using this material is not the sender's responsibility.  The sender's entire liability will be limited to resupplying the material.




More information about the AccessD mailing list