Exporting AP2700 Measurements to a Database

Created on 2008-07-11 12:52:00

We often get requests for information on how to export test results directly from AP software into a third party database. This can be done relatively easily through an AP Basic macro run inside AP2700 software. All that’s required is Windows XP and an MS Access data file ready to receive the data export from the AP software.

Follow the below instructions to set up your AP2700 to a database

1. Set up the measurement you wish to take.

  1. Start up AP2700 on your computer.
  2. Connect the device under test.
  3. Set up the measurement parameters inside the AP2700 software.

2. Create an MS Access data file on your computer.

  1. Create names for each field by mapping the columns from the AP2700 data editor to the columns in the database table.
  2. Refer to your database’s help file for instructions on how to do this.

3. Create and save the Macro using the template below.

  1. Go back to AP2700.
  2. Open the Macro menu and chose “Open Panel”.
  3. Copy the below script into the Panel.
  4. Edit the line “”C:Your_FolderYour_dbase.mdb”” so it maps to the location of your data file.
  5. Make sure the macro’s column parameters units (e.g.: Hz and %) match the settings in the AP2700 software.
  6. Save the macro in a folder of your choice (defaults to AP2700 folder).

4. Run the macro from inside AP2700.

  1. Go to File / Open / Macro and browse to the macro you saved.
  2. Open the macro and run it.
  3. You will be prompted to name the measurement or instrument you’re testing. This name will be added to the data file so you can identify this acquisition later.

The Macro will take the measurement you set up in Step (1c) and then automatically export the acquired data into the data file you specified in Step (3d).

You can now repeat the process to add more measurements to the data file or use the Microsoft ODBC protocol to allow your preferred database manager to analyze the results as needed, for example plotting standard deviation to indicate production run quality.

' Audio Precision Tech Support

‘ Macro Description:
‘ This macro shows how to use the Microsoft DAO (Data Access Objects)
‘ collection to connect AP Basic to an MS Access Dbase
Sub Main Dim DBEngine As Object
Dim DB As Object
Dim RS As Object
Dim FreqArray As Variant
Dim AmplArray As Variant

— These commands load the activex DAO object ——

Set DBEngine = CreateObject(“DAO.DBEngine.35”)
DBEngine.SystemDB = “C:WindowsSystemsystem.mdw”
DBEngine.DefaultUser = “NewUser”
DBEngine.DefaultPassword = “”
DBEngine.CreateWorkspace(“JetWorkspace”, “admin”, “”,2)

‘Make MS Access Connection
Set DB = DBEngine.OpenDatabase(“C:Your_FolderYour_dbase.mdb”)
Set RS = DB.OpenRecordSet(“SweepData”)

‘— Input your test conditions (product, serial no. etc.)

Product = InputBox(“Enter Product”)
SerialNo = InputBox(“Enter Serial Number”)

Length = AP.Data.ColSize(0,0) ‘<— returns the number of rows in the sweep

FreqArray = AP.Data.XferToArray(0, 0, “Hz”) ‘<— Your column parameters
AmplArray = AP.Data.XferToArray(0, 1, “%”) ‘<— Units must match instrument state.

For i = 0 To length -1 ‘�- iterate rows mapping sweep data columns to fields
RS!Product = Product
RS!SerialNo = SerialNo
RS!SweepIndex = i
RS!Column1 = FreqArray(i)
RS!Column2 = AmplArray(i)
Next i


End Sub

As always, AP Tech Support is available five days a week to help with any instrument questions you have. Just email us if you need help customizing this script for your particular needs.