385 lines
12 KiB
Markdown
385 lines
12 KiB
Markdown
# term Process Sheet
|
|
Analysis generated on: 4/1/2025 4:05:57 PM
|
|
---
|
|
## Record Source
|
|
- [[Tables/Process]]
|
|
## Controls
|
|
| Control Name | Reference |
|
|
|--------------|-----------|
|
|
| Field113 | MetalType (from [[Tables/Process]]) |
|
|
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
|
|
| BlankSize | BlankSize (from [[Tables/Process]]) |
|
|
| PartSize | PartSize (from [[Tables/Process]]) |
|
|
| GrossWt | GrossWt (from [[Tables/Process]]) |
|
|
| ActualWt | ActualWt (from [[Tables/Process]]) |
|
|
| Utilization | Utilization (from [[Tables/Process]]) |
|
|
| SheetSize | SheetSize (from [[Tables/Process]]) |
|
|
| GrainDir | GrainDir (from [[Tables/Process]]) |
|
|
| GrainDir (Row Source) | |
|
|
| BlocksPerSheet | BlocksPerSheet (from [[Tables/Process]]) |
|
|
| BlanksPerBlock | BlanksPerBlock (from [[Tables/Process]]) |
|
|
| PartsPerSheet | PartsPerSheet (from [[Tables/Process]]) |
|
|
| ActualPartHeight | ActualPartHeight (from [[Tables/Process]]) |
|
|
| PartCost | PartCost (from [[Tables/Process]]) |
|
|
| Field238 | PartsPerBlank (from [[Tables/Process]]) |
|
|
| PartNumber | PartNumber (from [[Tables/Process]]) |
|
|
| PartName | PartName (from [[Tables/Process]]) |
|
|
| IssueNumber | IssueNumber (from [[Tables/Process]]) |
|
|
| IssueDate | IssueDate (from [[Tables/Process]]) |
|
|
| PreviousIssue | PreviousIssue (from [[Tables/Process]]) |
|
|
| PreviousDate | PreviousDate (from [[Tables/Process]]) |
|
|
| Programmer | Programmer (from [[Tables/Process]]) |
|
|
| PrintSize | PrintSize (from [[Tables/Process]]) |
|
|
| History | History (from [[Tables/Process]]) |
|
|
| MetalType | MetalType (from [[Tables/Process]]) |
|
|
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
|
|
| FirstDim | FirstDim (from [[Tables/Process]]) |
|
|
| SecDim | SecDim (from [[Tables/Process]]) |
|
|
| BotTrimCut | BotTrimCut (from [[Tables/Process]]) |
|
|
| TopTrimCut | TopTrimCut (from [[Tables/Process]]) |
|
|
| CutType | CutType (from [[Tables/Process]]) |
|
|
| CutType (Row Source) | |
|
|
| Deburr | Deburr (from [[Tables/Process]]) |
|
|
| Deburr (Row Source) | |
|
|
| PartWidth | PartWidth (from [[Tables/Process]]) |
|
|
| ActualPartWidth | ActualPartWidth (from [[Tables/Process]]) |
|
|
| PartsPerBlank | PartsPerBlank (from [[Tables/Process]]) |
|
|
| PressBrake | PressBrake (from [[Tables/Process]]) |
|
|
| PressBrake (Row Source) | [[Tables/[PressBrakes];]] |
|
|
| EntPartHeight | PartHeight (from [[Tables/Process]]) |
|
|
| Field240 | CellDeburrTypes (from [[Tables/Process]]) |
|
|
| Field240 (Row Source) | |
|
|
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
|
|
| AddnlDeburrInches | AddnlDeburrInches (from [[Tables/Process]]) |
|
|
| Reason | Reason (from [[Tables/Process]]) |
|
|
| PunchPressOption | PunchOption (from [[Tables/Process]]) |
|
|
| PunchCount | PunchPartsPerStrip (from [[Tables/Process]]) |
|
|
| PunchDie | PunchNumber (from [[Tables/Process]]) |
|
|
| PunchDie (Row Source) | [[Tables/[punchpressQ1];]] |
|
|
| MakeNumber | MakeNumber (from [[Tables/Process]]) |
|
|
## VBA Code
|
|
```vba
|
|
Option Compare Database 'Use database order for string comparisons
|
|
|
|
|
|
Private Sub addPr_Click()
|
|
NewPartName_Parm$ = "NEW"
|
|
Call AddPartButton
|
|
End Sub
|
|
|
|
Private Sub Button184_Click()
|
|
Call Add_Additional_Process
|
|
End Sub
|
|
|
|
Private Sub Button190_Click()
|
|
On Error GoTo Err_Button190_Click
|
|
DoCmd.Quit
|
|
|
|
Exit_Button190_Click:
|
|
Exit Sub
|
|
|
|
Err_Button190_Click:
|
|
MsgBox Error$
|
|
Resume Exit_Button190_Click
|
|
|
|
End Sub
|
|
|
|
Private Sub Button193_Click()
|
|
NewPartName_Parm$ = Me!PartNumber
|
|
Call AddPartButton
|
|
End Sub
|
|
|
|
Private Sub Button194_Click()
|
|
On Error GoTo Err_Button194_Click
|
|
|
|
Dim DocName As String
|
|
Dim MyForm As Form
|
|
|
|
DocName = PrimaryScreen$
|
|
Set MyForm = Screen.ActiveForm
|
|
DoCmd.SelectObject A_FORM, DocName, True
|
|
DoCmd.PrintOut
|
|
DoCmd.SelectObject A_FORM, MyForm.name, False
|
|
|
|
Exit_Button194_Click:
|
|
Exit Sub
|
|
|
|
Err_Button194_Click:
|
|
MsgBox Error$
|
|
Resume Exit_Button194_Click
|
|
End Sub
|
|
|
|
Private Sub Button196_Click()
|
|
On Error GoTo Err_Button196_Click
|
|
|
|
Dim DocName As String
|
|
Refresh
|
|
DocName = "Process Sheet Print"
|
|
DoCmd.OpenReport DocName, A_PREVIEW, "Q1"
|
|
Exit_Button196_Click:
|
|
Exit Sub
|
|
|
|
Err_Button196_Click:
|
|
MsgBox Error$
|
|
Resume Exit_Button196_Click
|
|
|
|
End Sub
|
|
|
|
Private Sub Button200_Click()
|
|
Dim MainDB As Database, MainSet As Recordset
|
|
Dim MachNamesDB As Database, MachNamesSet As Recordset
|
|
Dim MachQDB As Database, MachQSet As Recordset
|
|
|
|
Set MainDB = DBEngine.Workspaces(0).Databases(0)
|
|
Set MachNamesDB = DBEngine.Workspaces(0).Databases(0)
|
|
Set MachQDB = DBEngine.Workspaces(0).Databases(0)
|
|
|
|
|
|
Set MachNamesSet = MachNamesDB.OpenRecordset("MachineNames", DB_OPEN_TABLE) ' Create dynaset.
|
|
Set MachQSet = MachQDB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
|
|
Set MainSet = MainDB.OpenRecordset("Process", DB_OPEN_TABLE) ' Create dynaset.
|
|
PartN$ = Me![PartNumber]
|
|
MainSet.Index = "PrimaryKey"
|
|
MachQSet.Index = "PartNumber"
|
|
MachNamesSet.MoveFirst
|
|
|
|
|
|
While Not (MachNamesSet.EOF)
|
|
A$ = MachNamesSet.MachineName
|
|
GoSub search
|
|
If Not (fnd) Then
|
|
MachQSet.AddNew
|
|
MachQSet.MachineName = A$
|
|
MachQSet.Tool = "***"
|
|
MachQSet.PartNumber = PartN$
|
|
MachQSet.Update
|
|
End If
|
|
MachNamesSet.MoveNext
|
|
Wend
|
|
Refresh
|
|
|
|
Exit Sub
|
|
|
|
search:
|
|
MachQSet.MoveFirst
|
|
MachQSet.Seek "=", PartN$, A$
|
|
If MachQSet.NoMatch Then
|
|
fnd = False
|
|
Else
|
|
fnd = True
|
|
End If
|
|
Return
|
|
End Sub
|
|
|
|
Private Sub Button244_Click()
|
|
On Error GoTo Err_Button224_Click
|
|
|
|
Dim DocName As String
|
|
Dim LinkCriteria As String
|
|
|
|
DoCmd.Hourglass True
|
|
|
|
DocName = "Data Sheet Select"
|
|
DoCmd.OpenForm DocName, , , LinkCriteria
|
|
DoCmd.FindRecord Me![PartNumber]
|
|
DoCmd.SelectObject A_FORM, PrimaryScreen$
|
|
DoCmd.Close
|
|
|
|
Exit_Button224_Click:
|
|
DoCmd.Hourglass False
|
|
Exit Sub
|
|
|
|
Err_Button224_Click:
|
|
MsgBox Error$
|
|
Resume Exit_Button224_Click
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub Button246_Click()
|
|
Call HistoryR
|
|
End Sub
|
|
|
|
Private Sub Button247_Click()
|
|
Call Delete_Part
|
|
End Sub
|
|
|
|
Private Sub Button248_Click()
|
|
Call Edit_The_Shear_Files
|
|
End Sub
|
|
|
|
Private Sub Button249_Click()
|
|
Call Find_By_PartNumber
|
|
End Sub
|
|
|
|
Private Sub Calculate_Click()
|
|
Call Calculate_Button
|
|
End Sub
|
|
|
|
Private Sub CutType_Click()
|
|
Call CutTypeFormSettings
|
|
End Sub
|
|
|
|
Private Sub FindMakeButton_Click()
|
|
Call Find_By_MakeNumber
|
|
End Sub
|
|
|
|
Private Sub FindPhantom_Click()
|
|
Call Find_By_PartNumber
|
|
End Sub
|
|
|
|
Private Sub Form_Current()
|
|
'
|
|
' Code to indicate record is locked (Requires a text object called LOCKEDRECORD
|
|
'
|
|
'
|
|
A$ = Me!IssueNumber
|
|
l = 0
|
|
On Error GoTo BadRecord
|
|
Me!IssueNumber = A$
|
|
If l <> 0 Then
|
|
LockedRecord.Visible = True
|
|
Else
|
|
LockedRecord.Visible = False
|
|
End If
|
|
|
|
Call CutTypeFormSettings
|
|
Call PBFormView
|
|
GrainFromRec
|
|
Call ErrorMessages
|
|
Exit Sub
|
|
BadRecord:
|
|
l = 1
|
|
Resume Next
|
|
|
|
End Sub
|
|
|
|
Private Sub Form_Load()
|
|
Set currform = Me
|
|
TextCalcErr.Visible = False
|
|
TextCalcErr.Top = 2.58 * 1440
|
|
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
|
|
DoCmd.GoToControl "PartName"
|
|
DoCmd.GoToControl "PartNumber"
|
|
End Sub
|
|
|
|
Private Sub GrDirOpt_Click()
|
|
NewGrain
|
|
End Sub
|
|
|
|
Private Sub PressBrakeSubForm_Enter()
|
|
Text234.Visible = True
|
|
Text237.Visible = True
|
|
End Sub
|
|
|
|
Private Sub PressBrakeSubForm_Exit(Cancel As Integer)
|
|
Text234.Visible = False
|
|
Text237.Visible = False
|
|
End Sub
|
|
|
|
Private Sub PunchDie_AfterUpdate()
|
|
If (PunchDie = "NONE") Or (Trim$(PunchDie) = "") Then
|
|
PunchPressOption.Visible = False
|
|
PunchCount.Visible = False
|
|
Else
|
|
PunchPressOption.Visible = True
|
|
If CutType = "Single" Then
|
|
PunchCount.Visible = False
|
|
Else
|
|
PunchCount.Visible = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub PunchPressOption_AfterUpdate()
|
|
If (CutType <> "Single") Then
|
|
If PunchPressOption = 2 Then
|
|
PunchCount.Visible = True
|
|
Else
|
|
PunchCount.Visible = False
|
|
End If
|
|
Else
|
|
PunchCount.Visible = False
|
|
End If
|
|
|
|
End Sub
|
|
|
|
```
|
|
## What it does
|
|
# VBA Code Description
|
|
=====================================
|
|
|
|
This VBA code is part of an Access database application and provides functionality for managing parts, processes, and related data. The code is organized into several subroutines, each handling specific actions or events.
|
|
|
|
## Subroutines Overview
|
|
|
|
### 1. `addPr_Click()`
|
|
|
|
* This subroutine is triggered when a button with the label "NEW" is clicked.
|
|
* It sets the `NewPartName_Parm$` variable to "NEW" and calls the `AddPartButton` procedure.
|
|
|
|
### 2. `Button184_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (184) is clicked.
|
|
* It calls the `Add_Additional_Process` procedure without specifying any arguments.
|
|
|
|
### 3. `Button190_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (190) is clicked.
|
|
* If an error occurs, it jumps to the `Err_Button190_Click` label and displays an error message.
|
|
* Otherwise, it calls the `Exit_Button190_Click` label, which exits the subroutine.
|
|
|
|
### 4. `Button193_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (193) is clicked.
|
|
* It sets the `NewPartName_Parm$` variable to the value of the "PartNumber" field in the current form and calls the `AddPartButton` procedure.
|
|
|
|
### 5. `Button194_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (194) is clicked.
|
|
* It sets the `DocName` variable to "Process Sheet Print" and opens the corresponding report using the `DoCmd.OpenReport` method.
|
|
|
|
### 6. `Button196_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (196) is clicked.
|
|
* It refreshes the data, opens the "Machines" table for editing, and sets the report to "Q1".
|
|
|
|
### 7. `Button200_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (200) is clicked.
|
|
* It creates several database objects (MainDB, MachNamesDB, MachQDB) and opens recordsets for these tables using the `OpenRecordset` method.
|
|
* It then loops through each machine in the "MachineNames" table and searches for a match in the "Machines" table using the `search` subroutine.
|
|
|
|
### 8. `Button224_Click()`
|
|
|
|
* This subroutine is triggered when a button with an unknown ID (224) is clicked.
|
|
* It opens the "Data Sheet Select" form and finds the record corresponding to the current part number.
|
|
|
|
### 9. `Button246_Click()`, `Button247_Click()`, `Button248_Click()`, `Button249_Click()`
|
|
|
|
* These subroutines are triggered when respective buttons with unknown IDs (246, 247, 248, 249) are clicked.
|
|
* They call other procedures, such as `HistoryR`, `Delete_Part`, `Edit_The_Shear_Files`, and `Find_By_PartNumber`, which are not defined in this code snippet.
|
|
|
|
### 10. `Calculate_Click()`
|
|
|
|
* This subroutine is triggered when a button with the label "Calculate" is clicked.
|
|
* It calls the `Calculate_Button` procedure, which is not defined in this code snippet.
|
|
|
|
### 11. `CutType_Click()`
|
|
|
|
* This subroutine is triggered when a button with the label "Cut Type" is clicked.
|
|
* It calls the `CutTypeFormSettings` procedure, which is not defined in this code snippet.
|
|
|
|
### 12. `FindMakeButton_Click()`, `FindPhantom_Click()`
|
|
|
|
* These subroutines are triggered when respective buttons with unknown IDs (Find Make Button and Find Phantom) are clicked.
|
|
* They call the `Find_By_MakeNumber` and `Find_By_PartNumber` procedures, which are not defined in this code snippet.
|
|
|
|
### 13. `Form_Current()`
|
|
|
|
* This subroutine is triggered whenever the form is updated or changed.
|
|
* It checks if a record is locked by checking the value of the "LOCKEDRECORD" field.
|
|
* If the record is locked, it displays a message indicating that the record cannot be edited.
|
|
|
|
Note: The `search` subroutine and other procedures mentioned in this code snippet are not defined within this code. They would need to be implemented separately in order for this code to function as intended.
|