|» SMS from Access||» SMS from C# .NET||» SMS from Visual Basic (VB6)|
|» SMS from Excel||» SMS from ASP .NET||» SMS from Visual C++|
This tutorial shows how to send/receive SMS from Access
database tables, using SMSLibX (ActiveX DLL) and a GSM
modem or phone.
The most important database tables are TPhonebook and TMessages (containing all SMS messages classified through the MessageStatus field).
The following queries can be used to filter TMessages, as like as they were real tables:
|Filters TMessages on...||Contains...|
|QMessagesOutbox||MessageStatus="TO SEND" (or null)||Messages to be sent|
To configure your system:
To send SMS from the form:
To send SMS from a table:
To receive SMS in a table:
Most recent Nokia and Symbian phones do not allow reading received SMS from PC through AT commands (i.e. the technology we are using). With these devices you will be able to send, but not to receive SMS from PC, unless you use the original software provided by the constructor.
You can examine the VBA source code used to send/receive SMS, by clicking on menu Tools > Macro > Visual Basic editor. In the next chapter you will learn how to send/receive SMS from VBA.
This example database and the related VBA source code can be extended as you like and freely re-used in your own applications.
For instance, you can:
SMS&Co rejects any responsibility for possible consequences associated with the use of this example and/or its SMS software.
This section is dedicated to Access/VBA programmers.
You will learn how to:
Now you're ready to use SMSLibX objects and methods directly in your source code.
To learn SMSLibX programming basics in 5 minutes, we recommend the
Quick Start Guide from SMSLibX Help.
You can use the following VBA source code in an Access form or class module, in order to send and receive SMS messages.
' Declare SMSModem object Public WithEvents Modem As SMSModem ' Send SMS Private Sub cmdSendMessage_Click() ' Open modem communication Set Modem = New SMSModem Modem.LogTrace = True Modem.OpenComm gsmModemSimulator, 3, , smsNotifyAll ' Send message Call Modem.SendTextMessage("+393401234567", "Hello world") End Sub ' Receive SMS by event Private Sub Modem_MessageReceived(Message As SMSLibX.SMSDeliver) MsgBox "New message received from " & Message.Originator & ":" _ & vbCrLf & vbCrLf & Message.Body, _ vbInformation, "New message received" End Sub
SMSModemis the most important object in the SMSLibX library.
WithEventsclause is essential in order to catch events raised by
OpenCommmethod call, you must replace the
gsmModemNokia...) Here's a good opportunity to try the code auto-completion.
3 (= COM3)with the actual modem COM port number.
Please read these notes carefully – they are very important for a good SMSLibX programming practice!
You may not know that... while there's an opened MsgBox or InputBox dialog in your application, VBA suppresses events generated by timers, forms, controls and any ActiveX components. Events are not simply delayed, but definitively suppressed (see Microsoft Knowledge Base 76557 article).
As possible consequence for this behaviour, you may loose events notifying received SMS (and similar) if they are raised while a MsgBox is open – and that eventuality can't be controlled, since it depends on user.
As a work-around, you should redefine the VBA MsgBox function, replacing it with the MessageBox
API from Windows, which does not suppress events (see Microsoft Knowledge Base 76557 article).
A concrete MsgBox re-definition example is available in the example database provided with this tutorial.
If your VBA application cycles over a list of SMS messages to be sent – or
performs any other time-consuming operations – then you should provide a
DoEvents statement in your loop (or time-consuming operaton).
This will allow SMSLibX to raise its events in real-time, notifying received messages, delivery reports, modem status updates etc. without significant delays.
Never put time-consuming operations in the VBA code managing SMSLibX events (e.g.
MessageReceived etc.), since SMSLibX relies on the calling thread for further message management and
As a general rule, the event management should never take more than 1 second.
If you want to send an automatic reply SMS to each incoming SMS, a good practice is: (a) create and store the reply message in a table (b) write a separate method activated by a timer (e.g. every 15-30 seconds) to process the message sending queue.
In this way, you will not charge the SMS reception event with the 3-4 seconds needed for SMS sending.
If SMSLibX is not correctly registered on your system, one of the following errors should appear when you open the example database:
To resolve the issue, please verify that SMSLibX has been previously installed on your system – then, if needed, restore the reference to SMSLibX.dll as explained in the first part of this tutorial.
For other kind of problems, please refer to the Troubleshooting section of SMSLibX Help.
Mar 18, 2013 - Given the numerous requests, we've made available a last stock of this item (discontinued in 2010). Contact us if interested.
- Working teams
Contact your customers and mobile co-workers by SMS.
- Mobile marketing
Contact your audience with friendly SMS communication.
- Services and associations
Contact service subscribers and associates by SMS.
- Commercial consultants
Remind fiscal deadlines to your customers with an SMS.
- Medical offices
Send appointment reminders to your patients by SMS.
Keep in contact with parents and students by SMS.
Different ways to send and receive SMS messages:
Create a message list and send it to multiple recipients with SMSList.
Integrate SMSLibX ActiveX into your web pages (ASP or other server-side technologies) to send and receive SMS from your site.
With SMSLibX you can add SMS sending and receival capabilities to Excel worksheets and Access databases.