How I Fixed the Macro Problem, "Compile Error, Library Not Found" Error

Larry R Harrison Jr
Thursday, April 12, 2001 10:13:22

Preface--this deals with the problem of certain computers not allowing records to be updated with the Date() function to flag the date/time the record was last modified. ("Compile Error Library Not Found" error) It requires you, among other things, to register an ActiveX component. An explanation follows.

The problem that I was having was that I had certain Visual Basic contained in the "Before Update" event procedure of a main form. This Visual Basic flagged the "date_modified" and "time_modified' fields with the current date/time, so that the records would be flagged with the date/time they had last been modified.

As the previous articles mentioned, this worked perfectly on my machine, but then they didn't work at all on other machines. It varied. Some machines it worked fine on, others it didn't work at all. The machine would jump into the code modules and read something like "compile error, library not found." I tried instead having a MACRO do this, and assigning the macro to the "before update" event procedure of the form. In that case, the database would stop and offer to halt the macro. And again, on the machines that didn't like the Visual Basic, it didn't like the macro; those that liked the Visual Basic also liked the macro.

I also noticed, too, that even the Date() function, which returns the current date, wasn't working. This is a function which I used a lot to specify the "default value" of many common date fields. I noticed that a text box which I had placed on a search form which used this function (this text box wasn't derived from a table) didn't show the default date on the "bad" machines. Instead, it gave the "#Name?" error. (Other than that, it worked.)

The solution that was suggested was for me to open up a code module, then type "tools....references" and to look for any item on the list marked "missing." In this case, the Calendar Control 8.0--an ActiveX component I use a lot (articles about it appear elsewhere in these help files)--was marked "missing." As instructed, I un-checked it and closed down.

This solved all the aformentioned problems perfectly. Now, however, the Calendar Control wasn't working, and I believe (though I'm not positive) it was working properly before. Earlier, in other scenarios, I had learned how to register ActiveX controls, and I guessed (correctly) that the Calendar 8.0 ActiveX control wasn't properly registered. I remember, too, that in that scenario I had downloaded a file named MsCal.Exe. When it asked me where I wanted to extract the files (there is only 1 file, MsCal.OCX), I specified the Windows/System32 (or WINNT/System 32) file. Then, in Access, I selected "Tools....ActiveX Controls," then I ignored the list on the left, which didn't contain the Calendar Control. I then selected "Register,," then browsed to the WinNT/System 32 folder where the OCX file was located.

This fixed the Calendar Control problem, and with the earlier procedures fixing the Date() macro/Visual Basic issue, all was fixed.