Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending SMS via Access Form

Status
Not open for further replies.

Moonlighting2

Programmer
Jul 24, 2007
4
GB
To keep things simple, I have stripped out the rest of the code and limited it to the main function, which is to send an SMS message on a click event, via a server that has been set up.

Error message is object required. This happens, of course, at the Set declaration. It's late, I'm tired, beginning to loose it a little and need help please.

Private Sub Command0_Click()
'On Error GoTo Err_Command0_Click
Dim sUrl
Dim sAPI_ID, sPassword, sUsername, sMobileNo, sText
Dim oXMLHTTP, sPostData, sResult
sUrl = "sAPI_ID = "something"
sPassword = "something"
sUsername = something"
sMobileNo = "something"
sText = "This is an example message"
sPostData = "api_id=" & sAPI_ID
sPostData = sPostData & "&user=" & sUsername
sPostData = sPostData & "&password=" & sPassword
sPostData = sPostData & "&to=" & sMobileNo
sPostData = sPostData & "&text=" & sText
Set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
oXMLHTTP.Open "POST", sUrl, False
oXMLHTTP.SetRequestHeader "Content-Type", "application/x-oXMLHTTP.Send sPostData
sResult = oXMLHTTP.responseText
Set oXMLHTTP = Nothing
MsgBox (sResult)
Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
'MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
 
I've no experience with what you are tring to do but gleaned this;

' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

from Have you tried the version 3 call?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top