BFanguy
asked on
Access 2010 MSXML2.XMLHTTP Issue
The http address specified in this code generates a new 10 digit number every time it is called in a browser, however, when calling through this code I only get a new number if I completely close the access program and re open it. I assume that the connection to this site is not closed and so each time it uses the same response as before but I cannot find anything about how to close a connection or to start a new connection with MSXML2.XMLHTTP. Is there someway to do this?
Private Sub Report_Load()
'Houma: http://10.10.1.29/unifi/voucher-houma.php
'Port Allen: http://10.10.1.29/unifi/voucher-pta.php
Dim objWeb As Object
Dim URL, wrq As String
' Instantiate an instance of the web object
Set objWeb = CreateObject("MSXML2.XMLHTTP")
'Set URL
If Environ("Username") = "VIMS-HMA" Then
URL = "http://10.10.1.29/unifi/voucher-houma.php"
ElseIf Environ("Username") = "VIMS-PTA" Then
URL = "http://10.10.1.29/unifi/voucher-pta.php"
Else
URL = "http://10.10.1.29/unifi/voucher-houma.php"
End If
' Pass the URL to the web object, and send the request
With objWeb
.Open "GET", URL, False
.Send
If .ReadyState = 4 And .Status = 200 Then
wrq = .responsetext
End If
End With
Me.WiFiKey = wrq
' Clean up
wrq = ""
URL = ""
Set objWeb = Nothing
End Sub
Try using the newer version 6:
' Instantiate an instance of the web object
Set objWeb = CreateObject("MSXML2.XMLHTTP60")
ASKER
Unfortunately there is no close method. I have already tried this and it gives me a compile error.
I will change my code to include 60 and let you know
I will change my code to include 60 and let you know
ASKER
Changing to the latest version. "60" did not help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How about objWeb.Close and reset it