Measurement Computing   Easy to Use | Easy to Integrate | Easy to Support catalog banner

Sending Universal Library generated data to a Microsoft Access...

Expand / Collapse

Sending Universal Library generated data to a Microsoft Access database, Part 1

This application note will span 6 knowledge base articles.

In all there will be 3 computers spanning this application,one to generate the data, one to store the data and one to read the data from afar.

Why would you want to do that?  The problem to solve is; “In near real time,how to read generated data remotely on multiple computers without them getting in the way of each other?”  The answer is, you do this by writing the data to a database.

We will create a Visual Basic.NET application capable of reading data from a USB-2408 using the Universal Library, writing the generated data to a Microsoft Access database on a separate computer or server, and then with another Visual Basic.NET application, read the generated data and display it graphically.

This application will not teach you everything you want or need to know about databases, nor is that its intention.

We will be using Microsoft Visual Basic.NET 2010, Microsoft Access 2013, Measurement Computing Universal Library, a USB-2408 for data collection, and BERGtools for the graphics.

Part 1 Setting up an MS Access database

Part 2: Creating the application to collect the data with VB.NET

Part 3: Creating the application to view the data with VB.NET

Part 4: Dispersing the application to view the data remotely

Part 5: Using other packages to view the data remotely

Part 6:  Tying it all together

Part 1 Setting up an MS Access database

Or more properly stated, adding an ODBC connection to the computer you are working on.

There are a lot of 'step by step' instructions on how to accomplish this on the internet, just Google “How to set up an odbc connection.”  In lieu of that, here are my 'step by step' instructions (as performed on Windows 7/64 bit).

You will need to put an ODBC connection on the computer you're working on. Click on Start>> Control Panel >> Administrative Tools, then double click on "Data Sources (ODBC)". Click on the "System DSN" tab. User DSN means that only you will be able to access this data source, and System DSN means that anyone who is on the machine should be able to access the data source (though only if they provide the necessary credentials). Now click on Add…

We will be using Microsoft Access, so select ‘Microsoft Access Driver (*.mdb, *.accdb),’ then click Finish.

The ODBC Microsoft Access Setup dialog appears.  Enter a Data Source Name, Description, and click on Create…

The new Database dialog appears.  Enter the name of the database.  Throughout this article, we will be working with the name MccGenericOdbc, and it is placed in C:\Users\Public\Documents.

Click on OK. If all went correctly you should see this message:

Click on OK, and you will be back to the ODBC Microsoft Setup now with the database name inserted:

Click OK, and now your ODBC Data Source Administrator will look like this:

Open the Windows explorer and navigate to C:\Users\Public\Documents to see your new database:

It is assumed you have a copy of Microsoft Access to complete the following steps.  However, if you do not, attached to this article is a useable copy of the database for this project.

Double click on MCCGenericOdbc.mdb to launch Microsoft Access and open the empty database.Click “Create”, “Table”.

A new Table appears. The first column is already labeled “ID”.  We need 5 additional columns for our table.  Notice the column to the right of ID is highlighted, and labeled “Click to add”.  Click on it, and a drop down menu appears with various options for the data type.  We want this first column to be the time the data was collected so select “Date & Time”.  The cursor moves to the field name location.  By default it is named “Field1”.  Change that to “Time”.  Repeat this process for the next 4 columns,making the data types all “Short Text”, and with the names changed to, “Temperature”, “Pressure”, “Tachometer”, and “Interlock”.

When completed, it will look like this:

Click on “File”, “Save”, and a Save as dialog appears.  Enter a name for the table.  Enter “TestData” and click OK.  Then close Access.  We will be reading and writing to this data table in the next sections.

The ODBC Microsoft Access database is attached to this KB article.

Rate this Article:


MccGenericOdbc.mdb MccGenericOdbc.mdb (212.00 KB, 734 views)

Add Your Comments

For comments email [email protected].

Article ID: 50617

Last Modified:10/13/2016 3:03:07 PM

Article has been viewed 2,397 times.