MSOUTL.OLB Version 9.4 missing (1 Viewer)

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
Couldn't resist. It works. At least on my home computer running Windows 10
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:11
Joined
Feb 28, 2001
Messages
27,138
Micron re post #36- you are right that "TO" is a reserved word - most often found as such in the context of FOR loops and as a range specifier in CASE clauses following SELECT CASE statements. However, it is also a valid property of an Outlook or CDO Message object, and as such will not be mistaken when properly qualified. Eljefegeneo has no choice but to use .TO when referring to that context and should not have issues. I never did. An isolated "TO" (without a leading dot) would indeed refer to a reserved word, but not in the case noted.
 

Micron

AWF VIP
Local time
Yesterday, 19:11
Joined
Oct 20, 2018
Messages
3,478
However, it is also a valid property of an Outlook or CDO Message object
Exactly what I was thinking at the time. My understanding is that there is a form control with that name, which I figure is/was the cause seeing as how the form has no To property. Why else would it work all of a sudden if the control name is changed to txtTo? That seems quite definitive to me. Or did I misread that bit?

Yet the To property is a semicolon- limited string, which in this case, seemed only to work when the control is named To if what it contains is coerced to a string. That I don't get.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:11
Joined
Feb 28, 2001
Messages
27,138
Micron: When dealing with the form control named To, it will work correctly if qualified as Me.To or as Form_FormName!To, but might cause trouble if referenced without a qualifier since (as you point out) txtTO is unequivocal but just-plain TO is ambiguous.

Granted, using TO as a control name is probably not wise, but the other cases of To are components of an object and will work as long as properly qualified. Our little sidebar is a good discussion for Eljefegeneo since it brings out a valid fine point about keyword and property usage in VBA.

But then again, we have always been in agreement that the left-hand side of the assignment isn't the problem. It was the right-hand side where TO could occur in isolation. My prior question has to do with what value is in the control and how is Access interpreting that object. (We must remember that a control is ALSO an object.)
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
I was updating more of my code to late binding and realized that the actual culprit may be in the modules section. Did find one or two modules there fortunately that I do not use any more that had early binding and are now deleted. Am I correct the the modules code load when the database is open and that was the early binding code that was throwing the error message?

The other early binding codes were on forms that the user open manually and not on the main menu form. Just asking so if more error appear I know where to look first.

Thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
I was updating more of my code to late binding and realized that the actual culprit may be in the modules section. Did find one or two modules there fortunately that I do not use any more that had early binding and are now deleted. Am I correct the the modules code load when the database is open and that was the early binding code that was throwing the error message?

The other early binding codes were on forms that the user open manually and not on the main menu form. Just asking so if more error appear I know where to look first.

Thanks.
To troubleshoot this, you could remove the reference and then try to compile your project. It should catch everywhere you used early binding.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:11
Joined
Feb 28, 2001
Messages
27,138
modules code load when the database is open

The few times I have tested this, modules don't seem to load until the first time you reference them. So, for example, if you have a switchboard form with a class module and it is declared as the "Opening Form" then that form gets loaded and its Form_Open event (in the class module) gets called followed by other form-related events. But if it happens that you didn't immediately call some functions or values from a particular general module, that module might not be there yet. I'm not 100% clear on that case but I have had what appeared to be deferred error declarations that didn't trigger on app load. They triggered on a particular action that was the first time a given module was called. That's not definitive but it points to possible deferred loading.
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
That being the case, then why did the error code that appeared in my first post occur. It was not called on the first form that opened. It occurred when the database opened and the log in screen appeared. Just trying to figure out why the error was called if the code was not called. The three codes that I changed to Late Binding were not called on opening of the DB - or were they and I just didn't know it?

And more important, if they were not yet called or even loaded and therefore not the reason for the error, what caused it? Compiling the code does not throw any errors on my Windows 10 machine. I guess I will have to wait until the user informs me of any new problems.

Thanks for responding.
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
[FONT=&quot]Found this:

https://sourcedaddy.com/ms-access/understanding-module-load-demand.html

[/FONT][FONT=&quot] So, the code module code does not load automatically, only "On Demand". And I had it checked as per the article:[/FONT]

[FONT=&quot]"Fortunately for all Access developers, this complete loading of a potential call tree has been addressed in Access 2010. Access now automatically compiles modules on demand, instead of loading the entire potential call tree.[/FONT]
[FONT=&quot]Note:[/FONT][FONT=&quot] You can turn off the Compile on Demand option if you prefer, making Access compile all modules at one time. You do this in the VBA program rather than in Access. (Access links directly to VBA's development environment for working with VB code.)[/FONT]
[FONT=&quot]To check the status of the Compile on Demand option, follow these steps:[/FONT]

  1. [FONT=&quot]In the VBA editor window, choose Tools → Options.
    The Options dialog box appears.[/FONT]
  2. [FONT=&quot]Select the General tab, and either check or uncheck the Compile On Demand check box.[/FONT]
  3. [FONT=&quot]Click OK."[/FONT]
[FONT=&quot]The mystery of why the Early Binding Code error was thrown continues.[/FONT]
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:11
Joined
Feb 28, 2001
Messages
27,138
The three codes that I changed to Late Binding were not called on opening of the DB - or were they and I just didn't know it?

Even if you don't call the modules, there is also the possibility of referencing any public variable kept in your general modules. That counts, too. Like, perhaps setting some flag to FALSE or setting any public variable to zero. Any reference - read, write, or call - counts to activate the module.

Great catch on that article, by the way. It confirms what I thought I had seen but at the time it happened to me, I wasn't researching that particular question and so let it pass.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
Compiling the code does not throw any errors on my Windows 10 machine.
Hi. Just out of curiosity, could you please enter the following in the Immediate Window on your Win10 machine?

Code:
?olNoteItem
What do you get?
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
[FONT=&quot]Opened DB, got the LogIn Form, used ALT then F11, took about a minute for the VBA window to appear. Typed in olNoteItem, hit return and got 5. This is on my home machine. Windows 10. Have not yet had confirmation of the DB opening yet on the Windows 10 machine at work. [/FONT]
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
[FONT=&quot]Opened DB, got the LogIn Form, used ALT then F11, took about a minute for the VBA window to appear. Typed in olNoteItem, hit return and got 5. This is on my home machine. Windows 10. Have not yet had confirmation of the DB opening yet on the Windows 10 machine at work. [/FONT]
Hi. Thanks. Unfortunately, that's what I expected you would get. Which means, you're still set up for Early Binding. That's why the code compiled without any issues on your Win10 Machine. When I asked you earlier to remove the reference, I guess you may have missed one. To verify, could you please post a screenshot of your References window showing all the ones selected? Thanks again!
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
[FONT=&quot] Opened DB, got the LogIn Form, used ALT then F11, took about a minute for the VBA window to appear. Typed in olNoteItem, hit return and got 5. This is on my home machine. Windows 10. Have not yet had confirmation of the DB opening yet on the Windows 10 machine at work.[/FONT]
[FONT=&quot]
[/FONT]
[FONT=&quot]The following code is on the LogIn Form:[/FONT]
Code:
  Option Compare Database
  Option Explicit
  Private intLogonAttempts As Integer
I have a variable that is declared in a module that is used on this form:

Code:
  gstrUsr = Me.cboEmployee.Column(1)
These are the only two declarations in the code that is on the form. The rest are merely hide or unhide the ribbon and tool bar, opening forms depending on what is selected from a drop down list of names, etc.

The module where gstrUsr is declared is a follows:

Code:
  Option Compare Database
  Option Explicit
  Public Declare PtrSafe Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  Public Declare PtrSafe Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  Public gstrUsr As String
   
   
  Function FindUserName() As String
      ' This procedure uses the Win32API function GetUserName
      ' to return the name of the user currently logged on to
      ' this machine. The Declare statement for the API function
      ' is located in the Declarations section of this module.
     
      Dim strBuffer As String
      Dim lngSize As Long
          
      strBuffer = String(100, " ")
      lngSize = Len(strBuffer)
      
         
      strBuffer = String(100, " ")
      lngSize = Len(strBuffer)
      
      If GetUserName(strBuffer, lngSize) = 1 Then
          'FindUserName = Left(strBuffer, lngSize)
          FindUserName = Left(strBuffer, lngSize - 1)
      Else
          FindUserName = "User Name not available"
      End If
   
   End Function
   
   Public Function FindComputerName()
      Dim strBuffer As String
      Dim lngSize As Long
          
      strBuffer = String(100, " ")
      lngSize = Len(strBuffer)
   
      If GetComputerName(strBuffer, lngSize) = 1 Then
          FindComputerName = Left(strBuffer, lngSize)
      Else
          FindComputerName = "Computer Name not available"
       End If
   End Function
Is there anything in the above code that could be causing the problem?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
Is there anything in the above code that could be causing the problem?
If by "problem" you're referring to the need to use theCStr() function, it has nothing to do with early or late binding, as evident by the use of the Value property. I mean, didn't you say you were able to make the late binding demo work without using the CStr() function if you added the Value property?
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 16:11
Joined
Jan 10, 2011
Messages
904
The attached is the screen shot of my references:
 

Attachments

  • References.jpg
    References.jpg
    92 KB · Views: 157

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
The attached is the screen shot of my references:
Okay, thanks. Uncheck the one for Microsoft Outlook 14.0 Object Library and then compile your project. This will tell you where you still have early binding code and can then convert them into late binding. Also, after unchecking this reference, if you go back to the Immediate Window and enter olNoteItem again, you shouldn't get 5 anymore.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:11
Joined
Oct 29, 2018
Messages
21,453
Okay, thanks. Uncheck the one for Microsoft Outlook 14.0 Object Library and then compile your project. This will tell you where you still have early binding code and can then convert them into late binding. Also, after unchecking this reference, if you go back to the Immediate Window and enter olNoteItem again, you shouldn't get 5 anymore.
As a side note, we have been discussing late binding Outlook in this entire thread. According to your References Window, you may have to late bind your Word and Excel codes as well.
 

Users who are viewing this thread

Top Bottom