user2320492
user2320492

Reputation: 151

Handle Special Characters in VBA on ms Access

I'm writing a VBA code to check for access for my Database: The code check if I have privilege to connect to a web server so it grants me access to the DB.

Function WebVer(ByVal StrUserName As String, ByVal StrPassword As String) As String

   Dim Access As String
   Dim objHTTP As Object
   Dim URL As String
   Dim Response As String


   Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
   URL = "http://myweb.com/authenticator?app=WebDNC_server&service=authenticate&userid=" & StrUserName & "&password=" & StrPassword    
   objHTTP.Open "GET", URL, False
   objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
   objHTTP.Send ("")
   LDAPResponse = UCase(objHTTP.responseText)

    If Response Like "*BAD*" Then
        WebVer= "BAD PASSWORD"
    ElseIf Response Like "*PASS*" Then
        WebVer= "PASS"
    ElseIf Response Like "*USERID*" Then
        WebVer= "USERID Not RECOGNIZED"
    Else
        WebVer= "CONNECTION ERROR"
    End If



End Function

Now everything is going fine except that if the user uses special characters in the password it returns BAD Password. I think there is a problem on how VBA handles Special characters but still do not know how to solve it. Any help would be appreciated.

Upvotes: 0

Views: 1548

Answers (1)

kismert
kismert

Reputation: 1692

I'm pretty sure you have to URL-encode the username and password.

See: How can I URL encode a string in Excel VBA?

Upvotes: 1

Related Questions