ms access compile error: user-defined type not defined - ms-access

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:
compile error: user-defined type not defined
Compiler Error: User-defined types not defined
What is "Compile error User-defined type not defined"?
w7 -> VB6 error "User-defined type not defined"
http://www.tek-tips.com/viewthread.cfm?qid=1731794
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.

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.

Related

SSRS project does not compile since migration - error BC30451

Since I have migrated my SSRS project to 2017, I'm getting over 300 errors like this one: "[rsCompilerErrorInExpression] The Color expression for the chart 'Chart18' contains an error: [BC30451] 'Helper' is not declared. It may be inaccessible due to its protection level."
Helper is our custom C# project including all our custom functions and properties used by the reports. I found a post that explained that I must put a copy of the dll into the folder: C:\Program Files (x86)\Microsoft Visual Studio xx.0\Common7\IDE\PrivateAssemblies\ depending on the VS version. But, I still get the same error.
I also checked the namespace but, in fact, nothing changed since years.
Any idea?
Regards,
Pascal

VBA Plugin Err: "Requested type library or wizard is not a VBA project"

I have created an .ade from an adp without problems.
When I try to open the .ade file I get the following error:
"Requested type library or wizard is not a VBA project"
The following files are my project:
Lib.ade (Version 1): external library
MainProgram.ade: compiled and made ade when the reference is to Version 1 and it works fine.
I sent these two file to client station without any problems but when I did some new changes and make new Lib.ade (Version 2) and sent to client environment, MainProgram (Version 1) gave the mentioned error.
Thanks for any help.
I got the same error message and it turned out to be a "Phantom Breakpoint" issue. See my posting here for more information:
https://stackoverflow.com/a/56565372/5795793
After several debug sessions in the original file (an ACCDB file in my case), it started breaking to a code line where I had previously, mistakenly left a breakpoint. Even though no breakpoint appeared, I had to duplicate the sub and comment out the original sub for it to work.
Sounds like there might be a phantom breakpoint in Version 2 of the Lib.ade. If so, copying the code elsewhere and commenting out the old code can work. Decompililng may also fix it.
Perhaps my experiences with the same problem will help someone.
Error "Requested type library or wizard is not a VBA project" occurred only in ACCDE, when trying to switch between tabs in level 2 navigation form. Explored all the options with references to library files, decompiling and recompiling, creating new DB and suppressing error message.
The only thing that worked for me is:
in ACCDB Remove all VBA code from the navigation form. Event Property Sheet sheet should be cleared of any events.
In the Other Property Sheet set "Has Module" to NO. (this should anyway delete the all code in the Navigation Form mentioned in step 1, so perhaps step 1 is not required, but better safe than sorry)
Save, Compact&Repair, Compile, Save as ACCDE
Enjoy.

Access 2013 Undefined function 'Format' in expression

I have created an access database which is used to create reports by various people. The database simply links to various external data sources. Via macros, it runs queries, creates reports and pushes them to a SharePoint site. The macro is triggered by a button. It runs fine for me. No errors and works perfectly. For another user in my department it doesn't work. She gets the following error:
Undefined function 'Format' in expression
I looked and the macro fails on an update query that runs. See the below screenshot.
It doesn't like the "Format" portion of the expression, but only on her PC. It works fine on mine. I don't use 'Format" for any other object in my database so I'm not sure why it would error out. I use the Format function all the time to format date values.
Any idea why this is selectively erroring out on one PC?
Problem: There is Reference List in VBA. Once you open (VBA environment-> Tools-> Reference), you will find a Checked mark in front of “MISSING”.
Solution: Uncheck that check Box which says “MISSING”, and save it.
Result: It will work
Same problem but in Access 2016, I didn't have any references reported as 'Missing' but I found adding in the following reference made it work:
C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB

Import MS Word Form Field to Access - Missing Reference?

I am trying to import data into access 2007 from a MS Word form field.
I have followed the tutorial here: http://msdn.microsoft.com/en-us/library/aa155434(v=office.10).aspx
When I run the VBA code I get a compile error that says "User-defined type not defined". After doing some research I've found that it is likely because I am missing a reference to an object in an object library.
I have the following object libraries referenced:
Visual Basic For Applications
Microsoft Access 12.0 Object Library
Ole Automation
Microsoft Office 12.0 database engine Object library
Microsoft Word 12.0 Object library
The error is thrown when the sub is called here:
Sub GetWordData()
Am I missing a reference, or do I have another problem?
Thanks in advance
Ensure that you have set a reference to the Microsoft ActiveX Data Objects x.x Library.
In the code window, choose Tools->References, scroll to the library and tick it.
Note that using library references, rather than late binding (Create.Object("Word.Application")), makes it easier to access properties and methods but can mean that your code will not run in other environments.

MS-Access compile options

Is there a compiler option in ms-access (2003) that requires all vba code to compile before allowing any code to run? I'd like to be able to turn it off. I've tried the unchecking the 'Require Variable Declaration' and 'Auto Syntax Check' options, but no result.
Background information
I've just been given an ms-access database that runs fine on their machine but will not run on my machine. I get this error message on startup:
"The expression On Open you entered as the event property setting produced the following error: Method or data member not found"
This is caused by vba compilation errors in what looks like redundant code. Interestingly the code doesn't compile on either machine, but on their machine it database is usable on my machine it isn't! I assume its something simple like a compiler option, except I can't find it!
(Before anyone mentions it I know that the real solution to the problem is to fix/remove the bad code)
Code will run in MS Access without all code compiling, however, On Open is a form property that runs code when the form is opened, so the code in that event will be compiled and run when the form opens. I have encountered this error before when a version of Access is run on a PC that has two versions installed (specifically, <2007 and >=2007). For me, the solution was to choose Repair from the Help menu.
Access has a /decompile command line switch. See the accepted answer to this StackOverflow question.