Reputation: 3
i am trying to add this to my code :
Dim myRS1 As DAO.Recordset
yet it gives me this error:
Compile error: user-defined type not defined
I have gone through these links:
Yet to no avail.
I have tried adding the Microsoft Access 3.6
library yet then it says Error in loading DLL
I don't understand, my previous projects use the exact same code yet they work completely fine.
Upvotes: 0
Views: 1968
Reputation: 1
Find any 'Database' or 'Recordset' Variable Type references in your Dim Statements, Functions or Sub Procedure Parameters that are not qualified with DAO. Add DAO to those Type References.
Example without DAO causes Error:
Function tLookupParam(pstrSQL As String, pdb As Database) As Variant
Example added DAO. to prevent the error:
Function tLookupParam(pstrSQL As String, pdb As DAO.Database) As Variant
Upvotes: 0
Reputation: 526
I guess we are taking about Access 2003 here. In the Visual Basic windows, menu 'Tools > References' having ticked & selected 'Microsoft DAO 3.6 Object Library', it should show the location of the DLL at the bottom of the form. It will be something like:
C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL
Check that DLL, and associated files exist. Compare the folders contents with another working PC, and copy across files as necessary. (Always take backup of original state.) The error 'Error in loading DLL' may indicate a corrupted DLL.
Also check the 'Object Browser', in the Visual Basic windows, menu 'View > Object Browser'. You should able to select the 'DAO' library in the Top Combo, and then browse it's Classes & Members.
Upvotes: 0