Walkthrough - collect data from RS232 into MS Access: (update as of CPS Plus version 6.3 it is possible to collect data from devices using keyboard emaulation) 1. Start MSAccess 2010 2. Create new database named: Sample.accdb and save it to some folder. 3. Click File -> Options -> Trust Center -> and click on button "Trust Center Settings..." 4. Select "Trusted locations" -> click button "Add new location..." 5. Select folder where you saved Sample.accdb and confirm. 6. Create new table named SerialLog and add following columns: SerialData -> Data Type: Memo RecDate -> Data Type: Text (50) RecTime -> Data Type: Text (50) 7. Create New Module and Copy/Paste following: Option Compare Database Option Explicit Global comport As Integer Function GetCPSDataNew(cport As Integer) comport = cport ' set mark to which port sent data End Function ' get data from CPS Plus Function GetCPSData() Dim ChannelNumber, MyData As Variant Dim cpsTopic As String Dim cpsComPortData As String cpsTopic = "COM" & CStr(comport) ' connect to RS232 port which initiated event cpsComPortData = "COM" & CStr(comport) & "DATA" ChannelNumber = DDEInitiate("CPSPLUS", cpsTopic) MyData = DDERequest(ChannelNumber, cpsComPortData) DDETerminate ChannelNumber 'MsgBox CStr(MyData) If Len(MyData) = 0 Then Exit Function Dim MyDB, MyTable 'Dim MyDB As Database, MyTable As Recordset ' <<< For Access Versions earlier than 2000 Set MyDB = CurrentDb() Set MyTable = MyDB.OpenRecordset("SerialLog") MyTable.AddNew ' insert data read from COM port into table named SerialData MyTable("SerialData") = MyData MyTable("RecDate") = Date MyTable("RecTime") = Time MyTable.Update MyTable.Close End Function 8. Create New Macro named GETDATA ->Action RunCode : Function Name: GetCPSData() 9. Let Access runing and activate CPS Plus. Switch to CPS Plus Terminal window. 10. Click Mode menu and select "SendSerial Data Using DDE" 11. Click Mode menu and select "Setup DDE..." 12. Check: Use DDE Client Mode and enter follwing values into appropriate fields: Client Application: MSACCESS Topic: Sample.accdb;SQL SELECT GetCPSDataNew($COMPORT) FROM SerialLog; DDE Command: GETDATA Command Type: EXECUTE 13. Confirm DDE setup. 14. Watch data transfer from serial devices directly into access table. -------------------------------------------------------------------------------------------------- Download sample database: http://www.programbl.com/resources/cpsdde2access2010.zip