Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 18:51
- Joined
- Jan 10, 2011
- Messages
- 904
Couldn't resist. It works. At least on my home computer running Windows 10
Last edited:
Okay, I think that's good news! Thanks!Couldn't resist. It works. At least on my home computer running Windows 10
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?However, it is also a valid property of an Outlook or CDO Message object
To troubleshoot this, you could remove the reference and then try to compile your project. It should catch everywhere you used early binding.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.
modules code load when the database is open
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?
Hi. Just out of curiosity, could you please enter the following in the Immediate Window on your Win10 machine?Compiling the code does not throw any errors on my Windows 10 machine.
?olNoteItem
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![FONT="]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]
Option Compare Database
Option Explicit
Private intLogonAttempts As Integer
gstrUsr = Me.cboEmployee.Column(1)
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
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?Is there anything in the above code that could be causing the problem?
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.The attached is the screen shot of my references:
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.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.