BRX Do-More Communication Do-More Do-More Designer HMI Modbus TCP PLC PLC Basics PLC Learning

Now You Can Have Robust Data Logging for Free – Part 6

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5
Now You Can Have Robust Data Logging for Free – Part 6

Computer Program Visual Basic (VB6)

We have looked at what VB is and discussed what we need to do in order to get the information out of the Do-More PLC and into an Access 2007 (*.accdb) database.

We will start by setting up the database. It will have the following two tables, Production_Log and Minute_Log. Please refer back to the data that we are storing in the PLC in Part 5.
Using Access create the two tables (Production_Log / Minute_Log) Name each record in the logs according to the data that we will be retrieving from the PLC.
See the tables below.
The database will be named AccRL.accdb. This is an access 2007/2010 database.
We will store the database in the following directory:
The visual basic program file will be in the C:AccRL directory.

Now let’s start the visual basic programming:
Start a new project save it as AccRL in the directory mentioned above.

Add the Microsoft Winsock Control 6.0 component to the project. This will be needed to communicate through Ethernet to our PLC on the network.

Add the Microsoft ADO Data Control 6.0 (OLEDB) component to the project. This is required to communicate to the AccRL.accdb file created above.

This is what our program form looks like now.

We can now draw labels on our form for all of the data that we wish to display. Fonts sizes etc can all change based upon how you would like it to appear.
Note: Everything shown on the form are labels for the data. This program will just display the information that is being retrieved from the PLC.

Along the bottom of the form, you will notice that the Winsock control, two Adodc controls, and a timer have been added.
The Winsock control will be set up during the running of the program. On the form will add a variable to tell the IP address of the PLC. We will deal with it after the database information has been set up.
Each of the Adodc controls represents the two tables set up earlier. Adodc1 is for the Production_Log table and Adodc2 is for the Minute_Log.
Lets now set up Adodc1.
Right-click the control and select properties.

Select the ‘Use Connection String’ and click on Build.
Select ‘Microsoft Office 12.0 Access Database Engine OLE DB Provider’ and then click Next.

We will now enter where the data source is located. C:AccRLDataAccRL.accdb
Click ‘Test Connection’

If the connection is good you will receive the following message. If not please check the location of the data source and provider information mentioned earlier.

The last step is to set the table in the database.

Go back to the Property Page and select the RecordSource tab. The command type will be set for ‘2 – adCmdTable’ and the Table or Stored Procedure Name will be ‘Production_Log’. You will notice that you will only be able to choose between the Production_Log and Minute_Log because they are the only two tables in the database file.
Now repeat the same steps and set up the Adodc2 for the Minute_Log table of the database.

In part 7 we will continue with writing the VB6 program.
If you have any questions or need further information please contact me.
Thank you,

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Leave a Reply

Your email address will not be published. Required fields are marked *