I seem to have run into a problem on windows 7 (32bit) when using the above in my access application.
I get the e开发者_JAVA百科rror '438', "Object doesn't support this property or method" on the last line of the below code.
strURL = "https://www.google.com/accounts/ClientLogin"
strFormData = "Email=" & myEmail & "&Passwd=" & myPassword & "&source=" & mySource & "&service=cl&accountType=HOSTED_OR_GOOGLE"
strHeaders = "Content-Type:application/x-www-form-urlencoded"
Inet1.Execute strURL, "POST", strFormData, strHeaders
I've succesfully (i believe) added MSINET.OCX using the command line prompt and 'regsvr32 msinet.ocx' and i've referenced Microsoft Internet Transfer Control
Obviously I'm not to sure what to do here and what I need to do to fix that problem that has manifested itself in Windows 7
If any one can help it would be appreciated.
Cheers
Noel
Edit: Initially I thought this error only happend on Win 7, as opposed to XP, however i went back to an XP machine and it is repeating the same problem. Do not know why as it didnt exist before, something somewhere is not playing right.
Resolved: Have no idea why I had the problems above. Managed to roll back to an older version and it began to work. Although as far as i can see there are no differences in the coding behind both forms. I can not explain what the problem was for the life of me!
The usual way to do this is to use the MS XMLHTTP object, rather than a non-native ActiveX control. The code would look something like this:
Dim oHTTP as Object
strURL = "https://www.google.com/accounts/ClientLogin"
strFormData = "Email=" & myEmail & "&Passwd=" & myPassword & "&source=" & mySource & "&service=cl&accountType=HOSTED_OR_GOOGLE"
strHeaders = "Content-Type:application/x-www-form-urlencoded"
Set oHttp = CreateObject("MSXML2.XMLHTTP")
oHTTP.Open "POST", strURL & strFormData, True
oHTTP.setRequestHeader "Content-Type", strHeaders
oHTTP.send vbNullString
I have had this type of code working on Win2000, WinXP and Win7 64-bit without problems. Since it uses late binding, should there be a problem with the installation/registration of the XMLHTTP library, it's trappable, but I've never encountered one.
精彩评论