Error when using Microsoft Internet Transfer Control 6.0

送分小仙女□ 提交于 2019-12-12 05:57:46

问题


I seem to have run into a problem on windows 7 (32bit) when using the above in my access application.

I get the error '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!


回答1:


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.



来源:https://stackoverflow.com/questions/5426198/error-when-using-microsoft-internet-transfer-control-6-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!