qaqpbann.gif (1572 bytes)

trans.gif (85 bytes)spc-pc-info.gif (340 bytes)

Home
Software
Six Sigma
Certification
Books
Training
Support
Contact
Demos
Knowledge Center
Order Form
Search

Contents | Index

Example Access 97 Code

The following code will open the SPC application, open Sample4.qdb, and print an X-Bar chart based on the data in the column labeled "Height".

The code is part of the Form (i.e. dialog box) which has these properties:

  • button named cmdStart

  • text box named txtSPC for user to enter the path to the spcwin32.exe file

  • text box named txtData for user to enter the path to the sample4.qdb file

Private Sub cmdStart_Click()

On Error GoTo Err_cmdStart_Click

' path to spc executable

Dim strSPCPath As String, strSPC As String

strSPCPath = txtSPC

strSPC = strSPCPath + "\spcwin32.exe"

' path to sample4.qdb data file

Dim strDataPath As String, strData As String

strDataPath = txtData

strData = strDataPath + "\sample4.qdb"

' lauch program

Call Shell(strSPC, 1)

' initialize DDE link, get system channel

Dim lSystemChannel As Long

lSystemChannel = DDEInitiate("spcwin", "system")

' open sample4.qdb and set the return value as the topic string

Dim strCommand As String, strDatasetName As String

strCommand = "[OPEN(" + strData + ")]"

strDatasetName = Application.DDERequest(lSystemChannel, strCommand)

' get topic channel for dataset window

Dim lDataTopicChannel As Long

lDataTopicChannel = DDEInitiate("spcwin", strDatasetName)

' create an XBarR chart based upon the HEIGHT column, return value is chart name

Dim strChartName As String

strCommand = "[NEW.CHART(2,,,HEIGHT)]"

strChartName = Application.DDERequest(lDataTopicChannel, strCommand)

' print the chart to the default printer

strCommand = "[PRINT.CHART(" + strChartName + ")]"

Call Application.DDEExecute(lSystemChannel, strCommand)

Exit_cmdStart_Click:

Exit Sub

Err_cmdStart_Click:

MsgBox Err.Description

Resume Exit_cmdStart_Click

End Sub


Site Map | Privacy | About Us

Copyright © 1995-1999 Quality America Inc. All Rights Reserved