Nation wide text message from access??

alvarogueva

Registered User.
Local time
Yesterday, 17:24
Joined
Nov 5, 2016
Messages
91
:banghead:

Well;

Hi there.

We work with multiple drivers over the road, and one thing that we encounter is how to send information to them, without using the boss phone or our personal phone numbers.

I review multiple website that can indeed add text messaging trough the internet, but I there just make the workflow bumpy and difficult.

Is there a way to send information or pictures through access itself to a cell phone number?


Well I hope you guys had an amazing weekend!!! :)
 
Depends on having two things:

1. A program for Windows that can do this manually and ...

2.a The program brings with it a .DLL file to expose its functions via automation... or

2.b The program can be run from a command line shell.

Access itself will not send messages. It always uses some other facility. It natively can use Outlook (via MAPI calls and an Outlook Application Object) and could also send SMTP messages through a server (CDO calls - look up Collaboration Data Object). If you can make Outlook or a secondary SMTP function do it for you, then it would callable by Access.
 
I use Twilio to send text messages from within Access. I googled and found a sample db with the appropriate code. It isn't free, but it's cheap.
 
I use Twilio to send text messages from within Access.
same here.

If your drivers have smart phones, you can also send them an email if they have it set up - but be sure to make sure they can't view/respond whilst driving!

Whichever way, they clearly need a signal to receive.
 
There's also email-to-text, but that requires you know each person's provider, which can be a pain or impractical depending on how many you have.

CJ, do you handle responses? I don't because management didn't want to, but was curious if it was easy.
 
Last edited:
@Paul - no, only sending out, primarily to customer for appointment reminders or messages like 'your car is ready for collection'.

I've not really looked but think it works off the same API - but needs a timer event to trigger 'a peek' to see if there are any incoming messages. And I would imagine there is an additional cost involved.

Cancelled appointments cost my clients time which they can't get back - so the purpose of the SMS is to remind the client rather than giving them the opportunity to send a response to cancel it. Not convinced their logic is right, but it's their choice.

Research shows that about 7% of appointments are noshows and sending a reminder reduces the figure (how much by depends on the service, the type of client etc) but I've not found any research to demonstrate that providing a cancel or 'change time' response option is financially beneficial although I have noticed couriers are often providing that facility now.

The reminder text is a relatively easy sell to clients who need it - someone charging say £50/hour for a 35 hour week can expect to have 2 hours of no shows lost - £100/week. If they can get 1 hour back @ £50 at a cost of perhaps £2/week, its a bit of a no brainer:)
 
There's also email-to-text, but that requires you know each person's provider, which can be a pain or impractical depending on how many you have.

CJ, do you handle responses? I don't because management didn't want to, but was curious if it was easy.

Well... I feel a bit hasty on this but, if you already are using Twilio, why not share the code here? Just saying.

So it does send the messages over access? I was thinking on just using the email-to-phone but again as you said, its a pain to know each drive provider, and then if they change that, you have to go back and change that provider. a bit of a pain. Does Twilio automatically does that for itself?

Also, do you have find that hard to code? I want to use it in a subform on my navigation bar...

Let me know.

Thanks!!!
 
@Paul - no, only sending out, primarily to customer for appointment reminders or messages like 'your car is ready for collection'.

I've not really looked but think it works off the same API - but needs a timer event to trigger 'a peek' to see if there are any incoming messages. And I would imagine there is an additional cost involved.

Cancelled appointments cost my clients time which they can't get back - so the purpose of the SMS is to remind the client rather than giving them the opportunity to send a response to cancel it. Not convinced their logic is right, but it's their choice.

Research shows that about 7% of appointments are noshows and sending a reminder reduces the figure (how much by depends on the service, the type of client etc) but I've not found any research to demonstrate that providing a cancel or 'change time' response option is financially beneficial although I have noticed couriers are often providing that facility now.

The reminder text is a relatively easy sell to clients who need it - someone charging say £50/hour for a 35 hour week can expect to have 2 hours of no shows lost - £100/week. If they can get 1 hour back @ £50 at a cost of perhaps £2/week, its a bit of a no brainer:)


I been looking for API's for text messaging and Millage counting... any ideas?
 
why not share the code here?
You can find plenty of examples on line - just google 'twilio API' or similar. Your original question was

Is there a way to send information or pictures through access itself to a cell phone number?
this was just one of the suggestions as to how this might be done.
and Millage counting
depends on level of usage as to whether you can use it for free but google provide an API to calculate mileage. Again, plenty of examples on line.
 
You can find plenty of examples on line - just google 'twilio API' or similar. Your original question was

this was just one of the suggestions as to how this might be done.
depends on level of usage as to whether you can use it for free but google provide an API to calculate mileage. Again, plenty of examples on line.

I feel in an ocean of amazing people. Thank you!
It just so difficult. I been looking for videos online on how to get google's API and use it in Access but there is none! Also the same thing to get this information as for example:

How many miles has this car traveled from point A to B?
What about if there is A, B, C, and D?

what about how many miles in a weekly bases?
what about how many miles in a monthly bases?

All this is just impossible for me to find nowhere...
 
You can find plenty of examples on line - just google 'twilio API' or similar. Your original question was

this was just one of the suggestions as to how this might be done.
depends on level of usage as to whether you can use it for free but google provide an API to calculate mileage. Again, plenty of examples on line.

Ok sooooooooooooo.

I got up to the part that I need to add the Access Token into my database.

HOW THE HELL DO I DO THAT?!!!!!

Do I create a box... and then... WHAT? Do I have to create a notes box where I can type what I want to send???? I am so confuse! Anyone with some idea on how to add this on an access database? I see lots of Java, IOS or Android... but what about for Access???
 


I checked the stackover reference, it looks amazing , but I don't know where to put that code... Or how should I input it in a text box... Does that same code work for multiple locations? lets say 5?

for example, to calculate distances (driving) between point A, B, C, D, E.

gosh I definetly need to learn VBA, or I won't pull this one out.. DAMN!
 
Code:
 Does that same code work for multiple locations? lets say 5?
for example, to calculate distances (driving) between point A, B, C, D, E.
in terms of the call to google, I believe the principle is the same - if you go onto google maps and put in your 5 destinations then look at the hyperlink created - that is basically what you will require. Or again google your question, it has been asked before.

Just be aware there are limits for its use, no idea how that is determined - number of calls per day perhaps so there may be a cost involved - google for license information.

Also in use, be aware that your db may need to take account of temporary changes due to road closures (work/accidents/events) and the like.

What one of my clients has done is having calculated the distance between two postcodes they store the values (start and end postcodes plus distance and time) so it does not have to be calculated again - but they then compare actual mileage and time recorded for variations (which is where I got involved) with +- allowance and build in more complex calculations based on time of day to allow for rushhour issues.
 

Hey boss! I follow the guide you show me, but I run over problems. I did add the whole complete thing in my database, but now I run over multiple problems. the first to be this one:

ByRef Argument type Mismatch
Code:
Private Sub btnOK_Click()

    Dim msg As String
    msg = Me.txtMessage.Value

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
    Set db = CurrentDb

    Dim qdf As QueryDef
    Set qdf = CurrentDb.QueryDefs("RosterQ")

    Set roster = qdf.OpenRecordset()
   
    roster.MoveFirst

    Do While roster.EOF = False

        SendSMS FROMPHONE, roster![ContactNumber], msg
    
    roster.MoveNext

  Loop

End Sub

Any idea why this is happening?

Also, in the whole code from where I am suppose to send the text message:
Code:
Private Sub txtMessage_KeyPress(KeyAscii As Integer)
   LimitKeyPress Me.txtMessage, 160, KeyAscii
End Sub

Function SendSMS(fromNumber As String, toNumber As String, body As String)
    
    Dim SmsUrl As String
    'Dim CallUrl As String
    Dim TwimlUrl As String
    Dim postData As String
    
    On Error GoTo Error_Handler

' ******************************************************
'
' To switch to from sending SMS messages to making
' phone calls, comment out the SmsUrl and postData
' variables and uncomment CallUrl, TwimlUrl and
' postData variables below.
   
    SmsUrl = BASEURL & "/2010-04-01/Accounts/" & ACCOUNTSID & "/SMS/Messages"
    postData = "From=" & fromNumber _
                & "&To=" & toNumber _
                & "&Body=" & body
    
'    CallUrl = BASEURL & "/2010-04-01/Accounts/" & ACCOUNTSID & "/Calls"
'    TwimlUrl = "http://twimlets.com/" _
'                & "message?Message[0]=" _
'                    & "Due%20to%20inclement%20weather,%20todays%20practice%20has%20been%20canceled."
'    postData = "From=" & fromNumber _
'               & "&To=" & toNumber _
'               & "&Url=" & url
    
' ******************************************************
    
    ' setup the request and authorization
    Dim http As MSXML2.XMLHTTP60
    Set http = New MSXML2.XMLHTTP60
    
    http.Open "POST", CallUrl, False, ACCOUNTSID, AUTHTOKEN
    http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    
    ' send the POST data
    http.send postData
    
    ' optionally write out the response if you need to check if it worked
    Debug.Print http.responseText

    If http.Status = 201 Then

    ElseIf http.Status = 400 Then
        MsgBox "Failed with error# " & _
            http.Status & _
            " " & http.statusText & vbCrLf & vbCrLf
    ElseIf http.Status = 401 Then
        MsgBox "Failed with error# " & http.Status & _
            " " & http.statusText & vbCrLf & vbCrLf
    Else
        MsgBox "Failed with error# " & http.Status & _
            " " & http.statusText
    End If

Exit_Procedure:

    On Error Resume Next

    ' clean up
    Set http = Nothing

Exit Function

Error_Handler:

    Select Case Err.Number

        Case NOINTERNETAVAILABLE
            MsgBox "Connection to the internet cannot be made or " & _
                "Twilio website address is wrong"

        Case Else
            MsgBox "Error: " & Err.Number & "; Description: " & Err.Description

            Resume Exit_Procedure

        Resume

    End Select
End Function


Sub LimitKeyPress(ctl As Control, iMaxLen As Integer, KeyAscii As Integer)
On Error GoTo Err_LimitKeyPress
    ' Purpose:  Limit the text in an unbound text box/combo.
    ' Usage:    In the control's KeyPress event procedure:
    '             Call LimitKeyPress(Me.MyTextBox, 12, KeyAscii)
    ' Note:     Requires LimitChange() in control's Change event also.

    If Len(ctl.Text) - ctl.SelLength >= iMaxLen Then
        If KeyAscii <> vbKeyBack Then
            KeyAscii = 0
            Beep
        End If
    End If

Exit_LimitKeyPress:
    Exit Sub

Err_LimitKeyPress:
    'Call LogError(Err.Number, Err.Description, "LimitKeyPress()")
    Resume Exit_LimitKeyPress
End Sub
Sub LimitChange(ctl As Control, iMaxLen As Integer)
On Error GoTo Err_LimitChange
    ' Purpose:  Limit the text in an unbound text box/combo.
    ' Usage:    In the control's Change event procedure:
    '               Call LimitChange(Me.MyTextBox, 12)
    ' Note:     Requires LimitKeyPress() in control's KeyPress event also.

    If Len(ctl.Text) > iMaxLen Then
        MsgBox "Truncated to " & iMaxLen & " characters.", vbExclamation, "Too long"
        ctl.Text = Left(ctl.Text, iMaxLen)
        ctl.SelStart = iMaxLen
    End If

Exit_LimitChange:
    Exit Sub

Err_LimitChange:
    'Call LogError(Err.Number, Err.Description, "LimitChange()")
    Resume Exit_LimitChange
End Sub

Where I am suppose to type the Twilo AccoudID, or the AuthToken, or the phone number I received from Twilo????

I feel a goner! :(
 
Code:
 Does that same code work for multiple locations? lets say 5?
for example, to calculate distances (driving) between point A, B, C, D, E.
in terms of the call to google, I believe the principle is the same - if you go onto google maps and put in your 5 destinations then look at the hyperlink created - that is basically what you will require. Or again google your question, it has been asked before.

Just be aware there are limits for its use, no idea how that is determined - number of calls per day perhaps so there may be a cost involved - google for license information.

Also in use, be aware that your db may need to take account of temporary changes due to road closures (work/accidents/events) and the like.

What one of my clients has done is having calculated the distance between two postcodes they store the values (start and end postcodes plus distance and time) so it does not have to be calculated again - but they then compare actual mileage and time recorded for variations (which is where I got involved) with +- allowance and build in more complex calculations based on time of day to allow for rushhour issues.

I feel outside my parameter... The reason I need this information is because sometime, drivers have 3 or more stops. and we need this to calculate their payroll ( example: driver drove 4 delivers, with a total of 1699 miles )

idk if you know what I mean?

Also if you know anything about Twilo that you can bring an idea from? :)
 
I use Twilio to send text messages from within Access. I googled and found a sample db with the appropriate code. It isn't free, but it's cheap.

Boss I made a comment just know about what I am getting from twilio. Can you help me out please?
 
Hey boss!
I'm not your boss, so please do not call me that!
I follow the guide you show me, but I run over problems. I did add the whole complete thing in my database, but now I run over multiple problems. the first to be this one:

ByRef Argument type Mismatch
Code:
Private Sub btnOK_Click()
..
.. 
End Sub
Any idea why this is happening?
You didn't show in which codeline you got the error!
I've look at the code in Sub btnOK_Click, and see it is a lot of junk in it, declaring variables which are not used and other stupid things, so I've cleaned it up a little.
Code:
Private Sub btnOK_Click()
  Dim db As DAO.Database
  Dim rs As DAO.Recordset
  Dim msg As String
  
  Set db = CurrentDb
  Set rs = db.OpenRecordset("RosterQ")
  If Not rs.EOF Then
    msg = Me.txtMessage.Value
    rs.MoveFirst
    Do While Not rs.EOF
      SendSMS FROMPHONE, rs![ContactNumber], msg
      rs.MoveNext
    Loop
  End If
End Sub
I've noticed you are using a variable/constant "FROMPHONE", but I can't see where you've declared it and given it a value, I think that could cause the error you get.
So I suggest you put it in the top of the module, (remember to put in the correct value):
Code:
Const FROMPHONE As String = "FromPhoneNumber"
Also, in the whole code from where I am suppose to send the text message:
..
..
Where I am suppose to type the Twilo AccoudID, or the AuthToken, or the phone number I received from Twilo????

I feel a goner! :(
Also here I notice you are using variables/constants, ("ACCOUNTSID", "BASEURL" and "AUTHTOKEN", maybe more but check it your self), but I can't see where you've declared them and given them a value, so I suggest you put them in the top of the module, (remember to put in the correct value):
Code:
Const ACCOUNTSID As String = "YourAccountsID"
Const AUTHTOKEN As String = "YourAuthToken"
Const BASEURL As String = "TheBaseURL" 'I think it is "https://api.twilio.com"
So have I been your boss, you've been in big trouble now! :D:D:D
 

Users who are viewing this thread

Back
Top Bottom