| » SMS from Access | » SMS from C# .NET | » SMS from Visual Basic (VB6) |
| » SMS from Excel | » SMS from ASP .NET | » SMS from Visual C++ |
SMS Tutorials >This tutorial shows how to send/receive SMS from Access
database tables, using SMSLibX (ActiveX DLL) and a GSM
modem or phone.
Please note:
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:
Database Query |
Filters TMessages on... | Contains... |
| QMessagesSent | MessageStatus="Sent" | Sent messages |
| QMessagesReceived | MessageStatus="Received" | Received messages |
| QUnread | Unread=true | Unread messages |
| 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
Comments:
SMSModem is the most important object in the SMSLibX library.WithEvents clause is essential in order to catch events raised by SMSModem.OpenComm method call, you must replace the gsmModemSimulatorgsmModemSiemens, 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
notification.
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.
Sep 20, 2011 - Audiotel Modex GPRS (USB) is newly available on stock.
Jan 12, 2011 - Siemens TC35i and MC35i modems are now replaced by the successor Cinterion MC55i.
Jan 12, 2011 - Audiotel Industrial modem is now replaced by the successor Urmet Industrial.
May 19, 2010 - SMSLibX 2.6 and SMSList 2.14 releases are ready for download.
- 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.
- Schools
Keep in contact with parents and students by SMS.
Learn how to send SMS and receive SMS with SMSLibX:
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.