
B-75074EN/04 USER CUSTOMIZE 4.REFERENCING THE DATABASE
- 455 -
4.4.2 Description of VBA Scripts
To reference the database, various procedures described with VBA
scripts of Excel are used.
The major procedures are described below.
In the descriptions below, the name of a procedure and the name of the
module including the procedure are indicated in the following format:
Example GetLastStateConfig :: DB_Common
Procedure name
:: Module name
4.4.2.1 Database operation procedures
DB_Common module
The DB_Common module defines common procedures for acquiring
data from the
i CELL database.
GetLastStateConfig :: DB_Common
This procedure acquires data from the machining end ID setting table.
Data is acquired in an array of the structure (typLastStateConfig).
The following SQL statement is created:
tSQL = "SELECT w.LastID, w.LastStr" & _
" FROM WKPCLastStateConfig w" & _
" WHERE w.Order>= 1 AND w.Order<=5" & _
" ORDER BY w.Order"
From the machining end ID setting table, this SQL statement acquires
LastID and LastStr with Order not less than 1 and not greater than 5 in
ascending order of Order.
CheckMcnConfig :: DB_Common
This procedure checks if a machine name and number passed as
arguments are set in the workpieces process result setting table.
Whether a machine name and number are set is determined from
whether acquired data is present.
The following SQL statement is created:
tSQL = "SELECT wm.McnID, wm.McnName" & _
" FROM WKPCMcnName wm" & _
" WHERE wm.Enable=1 AND wm.McnName='" &
iMcnName & "' AND wm.McnID=" & iMcnNo
From the workpieces process result setting table, this SQL statement
acquires McnID and McnName with Enable set to 1, McnName and
iMcnName matching each other ,and McnID and iMcnNo matching
each other.