Page 1
Page 2
Make
sure that the adofiltr.dll can be found on the system path. normally it
is located in the Activesync installation path (c:\Program Files\Microsoft ActiveSync\).
I find that including it in the directory with the project, and releasing it with
the executable to live in the same dir as the EXE is the most reliable method
for making sure it is always found. Use regsvr32 adofiltr.dll to register
the file.
In the download button's click event place
the following code:
'==================================================
Dim
intRetVal as integer ' API Return value. Nonzero = error
On Error GoTo ErrHandler
'download from the desktop to the local DB
intRetVal = DESKTOPTODEVICE(txtDesktopDB.Text, _
"", False, True,
txtPPCDB.Text)
If intRetVal <> 0 Then
msgbox "Error "
& intRetVal & " Occurred."
Else
msgbox "Download
Successful"
End If
Exit Sub
ErrHandler:
MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbCritical
'==================================================
in
the upload button's click event place the following code
'==================================================
Dim
intRetVal as integer
On Error Goto ErrHandler
'upload from the local DB to the desktop DB
intRetVal = DEVICETODESKTOP(txtDesktopDB.Text,
_
"", False, True, txtPPCDB.Text)
If intRetVal
<> 0 Then
msgbox "An error occurred transferring the data"
Else
msgbox "Upload Successful"
End If
Exit Sub
ErrHandler:
MsgBox Err.Number & "
" & Err.Description, vbOKOnly + vbCritical
'==================================================
The
DESKTOPTODEVICE and DEVICETODESKTOP calls are both in uppercase (its not a typo,
thats how they are defined in the dll) and both take the parameters in the same
order, which is
- Desktop Database Filename
List
of Tables to be copied (leave blank for all, otherwise use Tablename..Tablename..,
e.g. "Employee..Stock.." and prefix tables that you wish to be read
only with an exclamation mark "!Employee..").
- Whether
or not to synchronise the tables during the operation
- Whether
or not to overwrite an existing file.
- Pocket PC Database
Filename
Run the project, enter the full path for
an access database (including.mdb) into the Desktop field, and the full path for
the pocket access database (include .cdb) into the PocketPC field, and try uploading
and downloading.

There
you have it. You can now copy Access database files programatically from the desktop
machine to the pocket pc converting to Pocket Access as you go, and Vice Versa.
[Editor's
Note]: Depending on the size of the database being copied the it may take some
time to "download" or "upload" the file. On my 802.11 equipped
iPAQ it took about 25 seconds to copy and convert the Northwind database.


In
the second article in this two part series, I will delve into the murky depths
of copying normal files to and fro between the desktop and the pocket pc.
Previous Page