Visual Basic for Applications (VBA) encountered a problem (1 Viewer)

shahiq

Registered User.
Local time
Today, 04:54
Joined
Mar 31, 2007
Messages
29
I am having some problem with the following code. I have put the code behind a button. its working perfectly fine when I use it on MDB version. The error message comes when i convert it to MDE.

Can somebody please tell me what I am doing wrong?


Quote
Code:
 [FONT=&quot]Private Sub Command259_Click()[/FONT]
  [FONT=&quot]    Dim myDB As DAO.Database[/FONT]
  [FONT=&quot]    Dim myRS As DAO.Recordset[/FONT]
  [FONT=&quot]    Dim oHttp As Object[/FONT]
  [FONT=&quot]    Dim strUrl, strMobileNumber  As String[/FONT]
  [FONT=&quot]    Dim StrJobType As String[/FONT]
  [FONT=&quot]    Dim StrMsg1 As String[/FONT]
  [FONT=&quot]    Dim StrMsg2 As String[/FONT]
  [FONT=&quot]    Dim StrMsg3 As String[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    Set myDB = CurrentDb[/FONT]
  [FONT=&quot]    Set myRS = myDB.OpenRecordset("tbl_SMS_Outbox", dbOpenDynaset)[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    Set oHttp = CreateObject("Microsoft.XMLHTTP")[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    strMobileNumber = DLookup("Contact", "Qry_SendSMS_Contactinfo")[/FONT]
  [FONT=&quot]    StrJobType = DLookup("ReqType", "Qry_SendSMS_JobType")[/FONT]
  [FONT=&quot]    StrMsg1 = "Dear Customer. We are unable to reach you by phone to rectify the fault which you have reported. Please contact our customer service on."[/FONT]
  [FONT=&quot]    StrMsg2 = "Dear Customer. We have been trying to reach you by phone regarding your installation. Please contact our customer service on."[/FONT]
  [FONT=&quot]    StrMsg3 = "Dear Customer. We have been trying to reach you by phone regarding your relocation request. Please contact our customer service on."[/FONT]
  [FONT=&quot]          [/FONT]
  [FONT=&quot]    If StrJobType = "No Picture" Then[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]        With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot]        .Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    ElseIf StrJobType = "Complaint" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]      ElseIf StrJobType = "MC ROL New" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    ElseIf StrJobType = "MC ROL Fault" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    ElseIf StrJobType = "Freezing" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    ElseIf StrJobType = "SMC Fault" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    ElseIf StrJobType = "iC ROL Fault" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg1 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg1[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    myRS.Close[/FONT]
  [FONT=&quot]    ElseIf StrJobType = "Analog to Digital" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]            With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    ElseIf StrJobType = "Digital New" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "New" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "J-Sat to MSO" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "MMDS to MSO" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "ACN to ITV" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "NPL to FTV" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]        ElseIf StrJobType = "iC ROL New" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg2 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg2[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]            ElseIf StrJobType = "Relocation" Then[/FONT]
  [FONT=&quot] [/FONT]
  [FONT=&quot]    strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" + "User" + "&password=" + "pass" + "&message=" + StrMsg3 + "&msisdn=" + strMobileNumber[/FONT]
  [FONT=&quot]        [/FONT]
  [FONT=&quot]    oHttp.Open "GET", strUrl, False[/FONT]
  [FONT=&quot]    oHttp.send[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    MsgBox (oHttp.responseText)[/FONT]
  [FONT=&quot]                With myRS[/FONT]
  [FONT=&quot]        .AddNew[/FONT]
  [FONT=&quot]        .Fields!obDate = Date[/FONT]
  [FONT=&quot]        .Fields!Obtime = Time()[/FONT]
  [FONT=&quot]        .Fields!ObJob = Me.jobbb[/FONT]
  [FONT=&quot]        .Fields!ObNumber = strMobileNumber[/FONT]
  [FONT=&quot]        .Fields!obMessage = StrMsg3[/FONT]
  [FONT=&quot]        .Fields!obResponse = oHttp.responseText[/FONT]
  [FONT=&quot]        .Fields!obAccount = Me.Entrance_subform1.Form![AccountNo][/FONT]
  [FONT=&quot].Fields!obsender = DLookup("LogInName", "qryCurrentUser")[/FONT]
  [FONT=&quot]        .Update[/FONT]
  [FONT=&quot]    End With[/FONT]
  [FONT=&quot]    [/FONT]
  [FONT=&quot]    End If[/FONT]
 

VilaRestal

';drop database master;--
Local time
Today, 12:54
Joined
Jun 8, 2011
Messages
1,046
I've tidied it up a bit to make it easier to read:

Code:
Private Sub Command259_Click()
      Dim myDB As DAO.Database
      Dim myRS As DAO.Recordset
      Dim oHttp As Object
      Dim strUrl, strMobileNumber  As String
      Dim StrJobType As String
      Dim StrMsg1 As String
      Dim StrMsg2 As String
      Dim StrMsg3 As String
  
      Set myRS = CurrentDb.OpenRecordset("tbl_SMS_Outbox", dbOpenDynaset)
  
      Set oHttp = CreateObject("Microsoft.XMLHTTP")
  
      strMobileNumber = DLookup("Contact", "Qry_SendSMS_Contactinfo")
      StrJobType = DLookup("ReqType", "Qry_SendSMS_JobType")
      StrMsg1 = "Dear Customer. We are unable to reach you by phone to rectify the fault which you have reported. Please contact our customer service on."
      StrMsg2 = "Dear Customer. We have been trying to reach you by phone regarding your installation. Please contact our customer service on."
      StrMsg3 = "Dear Customer. We have been trying to reach you by phone regarding your relocation request. Please contact our customer service on."
      strUrl = "http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username=" & Chr(34) & "User" & Chr(34) & "&password=" & Chr(34) & "pass" & Chr(34) & "&message=" & Chr(34)

      If StrJobType = "No Picture" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "Complaint" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "MC ROL New" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "MC ROL Fault" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "Freezing" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "SMC Fault" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "iC ROL Fault" Then
          strUrl = strUrl & StrMsg1 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg1, oHttp.responseText
      ElseIf StrJobType = "Analog to Digital" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "Digital New" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "New" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "J-Sat to MSO" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "MMDS to MSO" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "ACN to ITV" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "NPL to FTV" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "iC ROL New" Then
          strUrl = strUrl & StrMsg2 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg2, oHttp.responseText
      ElseIf StrJobType = "Relocation" Then
          strUrl = strUrl & StrMsg3 & Chr(34) & "&msisdn=" & Chr(34) & strMobileNumber & Chr(34)
          oHttp.Open "GET", strUrl, False
          oHttp.send
          MsgBox (oHttp.responseText)
          AddResponse myRS, strMobileNumber, StrMsg3, oHttp.responseText
      End If
      myRS.Close
End Sub

Private Sub AddResponse(ByRef rs As DAO.Recordset, ByVal strMobileNumber As String, ByVal strMessage As String, ByVal strResponse As String)
      With rs
          .AddNew
          !obDate = Date
          !Obtime = Time()
          !ObJob = Me.jobbb
          !ObNumber = strMobileNumber
          !obMessage = strMessage
          !obResponse = strResponse
          !obAccount = Me.Entrance_subform1.Form![AccountNo]
          !obsender = DLookup("LogInName", "qryCurrentUser")
          .Update
      End With
End Sub

I would expect you'd need quotation marks in the URL strings round each parameter you're passing to bulksms.vsms.net. If not then find and replace & Chr(34) with nothing.

Whether that fixes your problem or not I don't know but it does make it easier to understand the code
 

Users who are viewing this thread

Top Bottom