mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (June 2008)

Pushing Data to a Handheld

It is always possible for the handheld to contact the mEnable server and find out if there is any new data that needs to be pulled from the server. However, there are times when data is generated on the server and you want to push it to the handheld immediately (for example, "Your results are ready"). This can be done using mEnable, SMS messages, and Visual CE macros.

The first thing you want to do is create a form that pulls the data from the mEnable server. From within the Visual CE development environment:

  1. Select FILE | NEW FORM and design a form to display the data that is to be pushed to the hanheld.
  2. Select EDIT | MACROS/EVENTS. Create a new macro called PULL DATA with the following steps:
    1. mEnable synchronize
    2. Message box whose message is @var(56)
  3. Press the EVENTS button
  4. Set the "On Startup" event to run your PULL DATA macro.
  5. Click OK and CLOSE and save your form (MyForm.vce).

The next thing you need to do is to convince the handheld to run that form when an SMS message comes in. To do this, create another form (RecieveSMS.vce). This form does not need any underlying database. Put a command button on this form whose action is SMS RECEIVE MESSAGE. Set the "Command" to the form you created above (MyForm.vce). Set the "Argument" to @var(56). Download this form to the handheld, run the form, and press the button.

When the server want to push data to the handheld, it first puts the data in the table MyForm.vce is built over and then sends the following SMS message to the handheld:

.vce.Your results are ready

When the handheld receives this SMS message, it will automatically put the text of the message in @var(56) and launch MyForm.vce. When Myform.vce is launched, the startup macro will do a synchronization (to get the data to the handheld) and then display "Your results are ready" in a message box.

Previous Tips of the Month