initial commit

main
Jeremy 2025-04-06 20:21:39 -05:00
parent 5ed90c83b1
commit 9139abeaff
417 changed files with 53492 additions and 0 deletions

676
Forms/14 two.md Normal file
View File

@ -0,0 +1,676 @@
# 14 two
Analysis generated on: 4/1/2025 4:10:23 PM
---
## Record Source
- [[Tables/Util Selection C1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Tables/Util Selection C1]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Tables/Util Selection C1]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Tables/Util Selection C1]]) |
| PartSize | PartSize (from [[Tables/Util Selection C1]]) |
| GrossWt | GrossWt (from [[Tables/Util Selection C1]]) |
| ActualWt | ActualWt (from [[Tables/Util Selection C1]]) |
| Utilization | Utilization (from [[Tables/Util Selection C1]]) |
| SheetSize | SheetSize (from [[Tables/Util Selection C1]]) |
| GrainDir | GrainDir (from [[Tables/Util Selection C1]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Tables/Util Selection C1]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Tables/Util Selection C1]]) |
| PartsPerSheet | PartsPerSheet (from [[Tables/Util Selection C1]]) |
| ActualPartHeight | ActualPartHeight (from [[Tables/Util Selection C1]]) |
| PartCost | PartCost (from [[Tables/Util Selection C1]]) |
| Field238 | PartsPerBlank (from [[Tables/Util Selection C1]]) |
| PartNumber | PartNumber (from [[Tables/Util Selection C1]]) |
| PartName | PartName (from [[Tables/Util Selection C1]]) |
| IssueNumber | IssueNumber (from [[Tables/Util Selection C1]]) |
| IssueDate | IssueDate (from [[Tables/Util Selection C1]]) |
| PreviousIssue | PreviousIssue (from [[Tables/Util Selection C1]]) |
| PreviousDate | PreviousDate (from [[Tables/Util Selection C1]]) |
| Programmer | Programmer (from [[Tables/Util Selection C1]]) |
| PrintSize | PrintSize (from [[Tables/Util Selection C1]]) |
| History | History (from [[Tables/Util Selection C1]]) |
| MetalType | MetalType (from [[Tables/Util Selection C1]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Tables/Util Selection C1]]) |
| SecDim | SecDim (from [[Tables/Util Selection C1]]) |
| BotTrimCut | BotTrimCut (from [[Tables/Util Selection C1]]) |
| TopTrimCut | TopTrimCut (from [[Tables/Util Selection C1]]) |
| CutType | CutType (from [[Tables/Util Selection C1]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Tables/Util Selection C1]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Tables/Util Selection C1]]) |
| ActualPartWidth | ActualPartWidth (from [[Tables/Util Selection C1]]) |
| PartsPerBlank | PartsPerBlank (from [[Tables/Util Selection C1]]) |
| PressBrake | PressBrake (from [[Tables/Util Selection C1]]) |
| PressBrake (Row Source) | [[Tables/[PressBrakes];]] |
| EntPartHeight | PartHeight (from [[Tables/Util Selection C1]]) |
| Field240 | CellDeburrTypes (from [[Tables/Util Selection C1]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Tables/Util Selection C1]]) |
| Reason | Reason (from [[Tables/Util Selection C1]]) |
| PunchPressOption | PunchOption (from [[Tables/Util Selection C1]]) |
| PunchCount | PunchPartsPerStrip (from [[Tables/Util Selection C1]]) |
| PunchDie | PunchNumber (from [[Tables/Util Selection C1]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Tables/Util Selection C1]]) |
| PunchStd | PunchStd (from [[Tables/Util Selection C1]]) |
| PhantomNumber | PhantomNumber (from [[Tables/Util Selection C1]]) |
| Gr3 | GrainNone (from [[Tables/Util Selection C1]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Tables/Util Selection C1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
On Error GoTo button288_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
Call diskout
End Sub
Private Sub Button324_Click()
'add a data sheet for Eugene!!!
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PressBrake_Click()
Call PBFormView
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
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is part of a Microsoft Access database application. It appears to be a custom form with various buttons and subroutines that perform different actions.
**Button Subroutines**
-----------------------
### addPr_Click()
* When the "addPr" button is clicked, it sets `NewPartName_Parm$` to "NEW" and calls the `AddPartButton` subroutine.
* This action is likely used to create a new part in the database.
### Button184_Click()
* When the second button (184) is clicked, it calls the `Add_Additional_Process` subroutine without any parameters.
### Button190_Click()
* When the third button (190) is clicked, it attempts to quit the application using `DoCmd.Quit`.
* If an error occurs during this process, it jumps back to the `Err_Button190_Click` label and displays an error message.
* If the operation succeeds, it proceeds to the next step.
### Button193_Click()
* When the fourth button (193) is clicked, it sets `NewPartName_Parm$` to the current value of `Me!PartNumber`.
* It then calls the `AddPartButton` subroutine using the updated part number.
* This action appears to be used for creating or updating a part in the database.
### Button194_Click()
* When the fifth button (194) is clicked, it attempts to print an existing report named "Primary Screen".
* If any errors occur during this process, it jumps back to the `Err_Button194_Click` label and displays an error message.
* If the operation succeeds, it proceeds to refresh the form.
### Button196_Click()
* When the seventh button (196) is clicked, it checks if there are any calculations in progress by looking at the calculation status of the current form.
* If there are calculations, it sets a variable `M$` to an error message and displays a messagebox with this value.
* It then attempts to refresh the report named "Process Sheet Print".
* If any errors occur during this process, it jumps back to the `Err_Button196_Click` label and displays an error message.
### Button200_Click()
* When the eighth button (200) is clicked, it opens three database tables: `MainDB`, `MachNamesDB`, and `MachQDB`.
* It then sets up recordsets for these tables and performs a series of searches to find matching machines based on the current part number.
* If any errors occur during this process, it jumps back to the `Err_Button200_Click` label and displays an error message.
### Button244_Click()
* When the twenty-fourth button (244) is clicked, it opens a new form named "Data Sheet Select" with a link criterion that finds records based on the current part number.
* It then attempts to find a record in this table using `DoCmd.FindRecord`.
* If successful, it selects the primary screen and closes the data sheet select form.
### Button246_Click()
* When the twenty-sixth button (246) is clicked, it calls the `HistoryR` subroutine without any parameters.
### Button247_Click()
* When the twenty-seventh button (247) is clicked, it opens a new form named "YESORNO" with a message asking to delete the current part.
* It then enters an infinite loop until the user clicks "1" in the message box. If the user chooses not to delete the part, it exits the subroutine.
### Button248_Click()
* When the twenty-eighth button (248) is clicked, it calls the `Edit_The_Shear_Files` subroutine without any parameters.
### Button249_Click()
* When the twenty-ninth button (249) is clicked, it calls the `Find_By_PartNumber` subroutine without any parameters.

View File

@ -0,0 +1,663 @@
# 14_ Process Sheet old
Analysis generated on: 4/1/2025 4:08:47 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | [[Tables/[PressBrakes];]] |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
On Error GoTo button288_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
Call diskout
End Sub
Private Sub Button324_Click()
'add a data sheet for Eugene!!!
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PressBrake_Click()
Call PBFormView
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
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
**Button Click Event Handlers in VBA Code**
This code contains several Button click event handlers, each responsible for performing a specific task. Here's a detailed description of what each button does:
### 1. `addPr` Button (Command Button 184)
When clicked, this button calls the `AddPartButton` procedure and passes the string `"NEW"` as an argument.
### 2. `Button190` Command Button
When clicked, this button attempts to quit the database application. If an error occurs during this process, it displays an error message using `MsgBox Error$`. The `Exit_Button190_Click` label is then executed to exit the procedure.
### 3. `Button193` Command Button
Similar to `addPr`, when clicked, this button calls `AddPartButton` and passes the current value of `Me!PartNumber` as an argument.
### 4. `Button194` Command Button
When clicked, this button attempts to print a report using `DoCmd.PrintOut`. If the calculation status is not 0, it displays an error message using `MsgBox Error$. The procedure then calls `Exit_Button194_Click` to exit. If an error occurs during printing, it displays an error message and continues executing.
### 5. `Button196` Command Button
When clicked, this button checks the calculation status of the part in error. If so, it displays an error message using `MsgBox Error$. The procedure then calls `Refresh` to refresh the data. Otherwise, it opens a report named "Process Sheet Print" and prints it.
### 6. `Button200` Command Button
When clicked, this button opens several databases (`MainDB`, `MachNamesDB`, and `MachQDB`) and sets up Recordsets for various tables. It then performs the following actions:
* Moves to the first record in the "MachineNames" table.
* Calls the `search` subroutine.
* If no match is found, adds a new record to the "Machines" table using the machine name from "MachineNames".
### 7. `Button224` Command Button
When clicked, this button opens an hourglass cursor and displays a form named "Data Sheet Select". It then searches for a record in the database corresponding to the current value of `Me!PartNumber` using `DoCmd.FindRecord`. Finally, it closes the form.
### 8. `Button246` Command Button
When clicked, this button calls the `HistoryR` subroutine (not shown in the provided code).
### 9. `Button247` Command Button
When clicked, this button opens a form named "YESORNO", displays a message prompt with the string `"delete this part"`, and waits for user input using `Do Until YESORNO% \u003e 0`. If the user clicks Cancel, the procedure exits. Otherwise, it calls the `Delete_Part` subroutine (not shown in the provided code).
### 10. `Button248` Command Button
When clicked, this button calls the `Edit_The_Shear_Files` subroutine (not shown in the provided code).
### 11. `Button249` Command Button
When clicked, this button calls the `Find_By_PartNumber` procedure (not shown in the provided code).
### 12. `Button288` Command Button
When clicked, this button sets a variable (`PN$`) to the current value of `currform![PartNumber]`.
Note: The procedures mentioned in the code but not shown here are likely defined elsewhere in the VBA project and perform specific tasks related to data manipulation, printing, or report generation.

761
Forms/14_ Process Sheet.md Normal file
View File

@ -0,0 +1,761 @@
# 14_ Process Sheet
Analysis generated on: 4/1/2025 4:08:35 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/metalQ1;]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
| Pems | PemPress (from [[Queries/UniversalQ]]) |
| PemBefore | PemBefore (from [[Queries/UniversalQ]]) |
| STSCode | STSCode (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
Private Sub ActiveXCtl358_Click()
End Sub
Private Sub ActiveXCtl358_CommandComplete(ByVal returnValue As Long)
End Sub
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print 14"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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
Programmer.SetFocus
End Sub
Private Sub Button247_Click()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
' On Error GoTo button288_error
DoCmd.GoToRecord , , acNext
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
'Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
DoCmd.Hourglass True
Call diskout
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
End Sub
Private Sub Command357_Click()
DoCmd.Hourglass True
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Sub UpdateGWs()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
' currform.Refresh
PN$ = currform!PartNumber
PN$ = Left$(PN$, 7)
wh$ = currform!Warehouse
Set Main2Set = MainDB.OpenRecordset("RMSFILES#_MFWKP795", DB_OPEN_DYNASET) ' Create dynaset.
On Error Resume Next
Main2Set.MoveFirst
On Error GoTo 0
Users$ = myNTUserName$
Do
If Not (Main2Set.EOF) Then
If Trim$(Main2Set![UID]) = Users$ Then
Main2Set.Delete
End If
DoEvents
Else
DoEvents
Exit Do
End If
Main2Set.MoveNext
Loop
Gws$ = Format(itsaNull$(currform!GrossWt), "#.000")
aws$ = Format(itsaNull$(currform!ActualWt), "#.000")
matl$ = currform!Field113.Column(2)
pps$ = currform!PartsPerSheet
If currform!PartsPerBlank.Visible = True Then
ppb$ = currform!PartsPerBlank
Else
ppb$ = currform!BlanksPerBlock
End If
Main2Set.AddNew
Main2Set![UID] = Users$
Main2Set!PRDNO = PN$
Main2Set!KBLWH = wh$
Main2Set!netwt = aws$
Main2Set!GRSwt = Gws$
Main2Set![MATL#] = matl$
Main2Set!SSIZE3 = pps$
Main2Set!BSIZE3 = ppb$
Main2Set.Update
Main2Set.Close
MainDB.Close
'ActiveXCtl358.CommandString = "Call PGM(MFR795) PARM('" + Users$ + "')"
'currform!ActiveXCtl358.DoClick
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for what happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Filtered Parts"
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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 Programmer_LostFocus()
A$ = Me![Programmer]
If A$ = "SG" Or A$ = "CB" Then
Checkupload = True
Else
Checkupload = False
End If
End Sub
Private Sub PunchDie_AfterUpdate()
If (PunchDie = "!NONE!") Or (Trim$(PunchDie) = "") Then
PunchPressOption.Visible = False
PunchCount.Visible = False
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is written for a Microsoft Access database application. It appears to be part of an inventory management system, handling various tasks such as adding parts, printing reports, and managing machine data.
**Module Overview**
--------------------
The code consists of several private subroutines that are called in response to button clicks or other events. These subroutines perform specific actions, such as:
* Opening and closing forms
* Printing reports
* Adding parts to the inventory
* Managing machine data
* Handling errors
**Subroutine Descriptions**
---------------------------
### Button Click Subroutines
* `addPr_Click()`: Opens a new part form by calling the `AddPartButton` subroutine.
* `Button184_Click()`: Calls the `Add_Additional_Process` subroutine, which is not shown in this code snippet.
* `Button190_Click()`: Attempts to quit the application. If successful, it calls an `Exit_Button190_Click` label to exit the subroutine. If not, it displays an error message and continues execution.
* `Button193_Click()`: Calls the `AddPartButton` subroutine with the current part number as a parameter.
* `Button194_Click()`: Opens a report form by calling the `DoCmd.PrintOut` method. It also attempts to select the primary screen object. If successful, it calls an `Exit_Button194_Click` label to exit the subroutine. If not, it displays an error message and continues execution.
* `Button196_Click()`: Calls the `Refresh` subroutine and opens a report form named "Process Sheet Print 14". It also attempts to select the primary screen object.
### Error Handling Subroutines
* `Err_Button190_Click`, `Err_Button194_Click`, and `Err_Button196_Click`: Display error messages and resume execution of the corresponding subroutine labels.
### Machine Data Management Subroutine
* `Button200_Click()`: Opens database connections to multiple tables, such as "MachineNames" and "Machines". It then iterates over the records in these tables, checks for matches with the current part number, and adds new machines to the inventory if necessary. Finally, it calls the `Refresh` subroutine.
### History and Delete Subroutines
* `Button246_Click()`: Calls the `HistoryR` subroutine (not shown) and sets focus to a specific control.
* `Button247_Click()`: Opens a form named "YESORNO" and waits for user input. If the response is not 1, it calls the `Delete_Part` subroutine.
### Miscellaneous Subroutines
* `search`: A subroutine called within `Button200_Click()` to search for matches between part numbers and machine names.
* `AddPartButton`, `Add_Additional_Process`, `HistoryR`, and `Delete_Part`: These subroutines are not shown in this code snippet but are likely used elsewhere in the application.
**Notes**
--------
This VBA code appears to be designed for an inventory management system, handling various tasks related to part numbers, machine data, and report printing. The code could benefit from additional error checking, comments, and organization to improve maintainability and readability.

13
Forms/AddAProcess.md Normal file
View File

@ -0,0 +1,13 @@
# AddAProcess
Analysis generated on: 4/1/2025 4:10:23 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
## VBA Code
*None*
## What it does
*No VBA code to document*

21
Forms/AddnlMakeSubform.md Normal file
View File

@ -0,0 +1,21 @@
# AddnlMakeSubform
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/AddnlMKQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/AddnlMKQ]]) |
| OPCode | OPCode (from [[Queries/AddnlMKQ]]) |
| Description | Description (from [[Queries/AddnlMKQ]]) |
| WC1 | WC1 (from [[Queries/AddnlMKQ]]) |
| WC2 | WC2 (from [[Queries/AddnlMKQ]]) |
| WC3 | WC3 (from [[Queries/AddnlMKQ]]) |
| WC4 | WC4 (from [[Queries/AddnlMKQ]]) |
| CycleTime | CycleTime (from [[Queries/AddnlMKQ]]) |
| RunStd | RunStd (from [[Queries/AddnlMKQ]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,22 @@
# AllProcessSubform
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/AddnlQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/AddnlQ1]]) |
| OPCode | OPCode (from [[Queries/AddnlQ1]]) |
| Description | Description (from [[Queries/AddnlQ1]]) |
| WC1 | WC1 (from [[Queries/AddnlQ1]]) |
| WC2 | WC2 (from [[Queries/AddnlQ1]]) |
| WC3 | WC3 (from [[Queries/AddnlQ1]]) |
| WC4 | WC4 (from [[Queries/AddnlQ1]]) |
| Machine | Machine (from [[Queries/AddnlQ1]]) |
| CycleTime | CycleTime (from [[Queries/AddnlQ1]]) |
| RunStd | RunStd (from [[Queries/AddnlQ1]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,22 @@
# AllProcessSubform14
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/AddnlQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/AddnlQ1]]) |
| OPCode | OPCode (from [[Queries/AddnlQ1]]) |
| Description | Description (from [[Queries/AddnlQ1]]) |
| WC1 | WC1 (from [[Queries/AddnlQ1]]) |
| WC2 | WC2 (from [[Queries/AddnlQ1]]) |
| WC3 | WC3 (from [[Queries/AddnlQ1]]) |
| WC4 | WC4 (from [[Queries/AddnlQ1]]) |
| CycleTime | CycleTime (from [[Queries/AddnlQ1]]) |
| RunStd | RunStd (from [[Queries/AddnlQ1]]) |
| Machines | [Machine] (from [[Queries/AddnlQ1]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

62
Forms/CNCDefinitions.md Normal file
View File

@ -0,0 +1,62 @@
# CNCDefinitions
Analysis generated on: 4/1/2025 4:02:25 PM
---
## Record Source
- [[Queries/MachinesQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| MachineName | MachineName (from [[Queries/MachinesQ1]]) |
| CycleTime | CycleTime (from [[Queries/MachinesQ1]]) |
| Field4 | Tool (from [[Queries/MachinesQ1]]) |
| Field4 (Row Source) | |
| Field9 | Prime (from [[Queries/MachinesQ1]]) |
| Field9 (Row Source) | |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Field4_DblClick(Cancel As Integer)
Me!Tool = "STD"
Refresh
End Sub
Private Sub Field9_DblClick(Cancel As Integer)
Me!Prime = Not (Me!Prime)
Refresh
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code snippet is part of an Excel add-in, responsible for handling double-click events on two specific fields: `Field4` and `Field9`.
### Field4_DblClick Event Handler
#### Purpose
When the user double-clicks on a cell containing data in `Field4`, this event handler is triggered.
#### Actions
1. **Set Tool Value**: The code sets the value of `Me!Tool` to the string "STD".
2. **Refresh**: After setting the tool value, the add-in calls the `Refresh` method to update the display with the new tool value.
### Field9_DblClick Event Handler
#### Purpose
When the user double-clicks on a cell containing data in `Field9`, this event handler is triggered.
#### Actions
1. **Toggle Prime Value**: The code toggles the value of `Me!Prime` by using the bitwise NOT operator (`Not`). If `Me!Prime` is currently set, it will be reset to `False`, and vice versa.
2. **Refresh**: After toggling the prime value, the add-in calls the `Refresh` method to update the display with the new prime value.
### Comparison Context
The first line in each code snippet (`Option Compare Database`) specifies that string comparisons should be performed using database order. This is a VBA option that ensures case-insensitive and locale-aware string comparisons.

View File

@ -0,0 +1,973 @@
# Copy of Process Sheet
Analysis generated on: 4/1/2025 4:03:52 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/metalQ1;]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
| Pems | PemPress (from [[Queries/UniversalQ]]) |
| PemBefore | PemBefore (from [[Queries/UniversalQ]]) |
| STSCode | STSCode (from [[Queries/UniversalQ]]) |
| chkRotateBlank | GrainShear (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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 LogFile(currform!PartNumber, "Save As New Part")
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
If Left$(Initforms$, 2) = "14" Then
DocName = "Process Sheet Print 14"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
Else
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1"
End If
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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
Programmer.SetFocus
End Sub
Private Sub Button247_Click()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
Call LogFile(currform!PartNumber, "Delete Part")
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
' On Error GoTo button288_error
DoCmd.GoToRecord , , acNext
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
'Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
Button322.Caption = "Processing"
DoCmd.Hourglass True
Call diskout
Call UpdateGWs
DoCmd.Hourglass False
Button322.Caption = "Create Disk Output"
Call LogFile(currform!PartNumber, "Create Disk Output")
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$, rst!)
'If Checkupload = True Then
'Call buttUpload_Click
'End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = Directory$ & "UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
'MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call MoveFilesToPrefixLocation
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
Call Button327_Click 'Laser Fun
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
Call LogFile(currform!PartNumber, "Get Standard Machines")
End Sub
Private Sub MoveFilesToPrefixLocation()
'PartN$ = "2327979D"
PartN$ = currform![PartNumber]
Dim Prefix As String
Prefix = Left(PartN$, 3)
If UCase(Left(PartN$, 1)) = "Z" Then Prefix = "Z"
If UCase(Left(PartN$, 1)) = "X" Then Prefix = "X"
Dim DestinationFolder As String
Dim SourcePath As String
Dim FilesToDelete As String
Dim strFileName As String
Dim strFolder As String: strFolder = "S:\FL3030\"
Dim strFileSpec As String: strFileSpec = strFolder & "*.*"
DestinationFolder = strFolder & Prefix
CreateDir (DestinationFolder)
strFileName = Dir(strFileSpec)
FilesToDelete = ""
Do While Len(strFileName) > 0
Debug.Print strFileName
If InStr(1, strFileName, PartN$, vbTextCompare) Then
SourcePath = strFolder & strFileName
FileCopy SourcePath, DestinationFolder & "\" & strFileName
FilesToDelete = FilesToDelete & SourcePath & vbCrLf
End If
strFileName = Dir
Loop
Dim MyFile() As String
MyFile = Split(FilesToDelete, vbCrLf)
For Each XFile In MyFile
If XFile <> "" Then
Kill (XFile)
End If
Next
Debug.Print FilesToDelete
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
Call LogFile(currform!PartNumber, "Calculate")
End Sub
Private Sub cmd300Series_Click()
DoCmd.Hourglass True
Set XrefQDB = DBEngine.Workspaces(0).Databases(0)
Set XrefQSet = XrefQDB.OpenRecordset("RMSFILES#_EGSSP1A0", DB_OPEN_DYNASET) ' Create dynaset.
XrefQSet.MoveFirst
PartN$ = currform![PartNumber]
xPN$ = Left(currform![PartNumber], 7)
newnum$ = ""
Do Until XrefQSet.EOF
If (Trim(XrefQSet!CURPN) = xPN$) Then
newnum$ = Trim(XrefQSet!NEWPN)
If newnum$ <> "" Then
newnum$ = newnum$ + Right(Trim(PartN$), 1)
End If
Exit Do
End If
XrefQSet.MoveNext
Loop
If newnum$ <> "" Then
Curprt$ = Directory$ + "VLT1\" + revext(PartN$)
If Exists(Curprt$) Then
NewPrt$ = Directory$ + "VLT1\" + revext(newnum$)
Open Curprt$ For Input As #1
Open NewPrt$ For Output As #2
While Not EOF(1)
Line Input #1, A$
If InStr(A$, PartN$) <> 0 Then
A$ = ReplaceStr(A$, PartN$, newnum$)
End If
Print #2, A$
Wend
Close #1, #2
End If
Curprt$ = Directory$ + "VT2\" + revext(PartN$)
If Exists(Curprt$) Then
NewPrt$ = Directory$ + "VT2\" + revext(newnum$)
Open Curprt$ For Input As #1
Open NewPrt$ For Output As #2
While Not EOF(1)
Line Input #1, A$
If InStr(A$, PartN$) <> 0 Then
A$ = ReplaceStr(A$, PartN$, newnum$)
End If
Print #2, A$
Wend
Close #1, #2
End If
End If
DoCmd.Hourglass False
End Sub
Function revext(p$)
revext = Left(p$, 7) + "." + Right(p$, 1)
End Function
Public Function ReplaceStr$(source$, Target$, Replc$)
'
'Replaces each instance of the string Target$ with the string Replc$ in the string Source$
'
NS$ = source$
FromPl% = 1
While InStr(Mid$(UCase$(NS$), FromPl%), UCase$(Target$)) <> 0
A% = InStr(Mid$(UCase$(NS$), FromPl%), UCase$(Target$))
A% = A% + FromPl% - 1
NS$ = Left$(NS$, A% - 1) + Replc$ + Mid$(NS$, A% + Len(Target$))
FromPl% = A% + Len(Replc$)
Wend
ReplaceStr$ = NS$
End Function
Private Sub cmdDeleteFileFromTrumpfs_Click()
On Error Resume Next
Dim x As String
x = "S:\Garrett\Trumpf_Clean_Machine\TrumpfReports\" & PartNumber
If Not Exists(x) Then
Open x For Output As #2
Print #2, Now()
Close #2
End If
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
End Sub
Private Sub Command357_Click()
DoCmd.Hourglass True
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Sub UpdateGWs()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
' currform.Refresh
PN$ = currform!PartNumber
'PN$ = Left$(PN$, 7)
PN$ = Mid(PN$, 1, Len(PN$) - 1)
wh$ = currform!Warehouse
Set Main2Set = MainDB.OpenRecordset("RMSFILES#_MFWKP795", DB_OPEN_DYNASET) ' Create dynaset.
On Error Resume Next
Main2Set.MoveFirst
On Error GoTo 0
Users$ = Trim(myNTUserName$)
Do
If Not (Main2Set.EOF) Then
If Trim$(Main2Set![UID]) = Users$ Then
Main2Set.Delete
End If
DoEvents
Else
DoEvents
Exit Do
End If
Main2Set.MoveNext
Loop
Gws$ = Format(itsaNull$(currform!GrossWt), "#.000")
aws$ = Format(itsaNull$(currform!ActualWt), "#.000")
matl$ = currform!Field113.Column(2)
pps$ = currform!PartsPerSheet
If currform!PartsPerBlank.Visible = True Then
ppb$ = currform!PartsPerBlank
Else
ppb$ = currform!BlanksPerBlock
End If
Main2Set.AddNew
Main2Set![UID] = Users$
Main2Set!PRDNO = PN$
Main2Set!KBLWH = wh$
Main2Set!netwt = aws$
Main2Set!GRSwt = Gws$
Main2Set![MATL#] = matl$
Main2Set!SSIZE3 = pps$
Main2Set!BSIZE3 = ppb$
Main2Set.Update
Main2Set.Close
MainDB.Close
'ActiveXCtl358.CommandString = "Call PGM(MFR795) PARM('" + Users$ + "')"
'currform! .DoClick
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
lblXrefMessage.Visible = False
cmd300Series.Visible = False
Call CrossRef
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
lblDedicatedCell.Caption = GetLineFromDedicated(Me!PartNumber)
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Function GetLineFromDedicated(Pnnum As String) As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer
Dim wrk, sql, Mach As String
wrk = Trim(Pnnum)
sql = "SELECT ProductMaster.PRDNO, DedicatedCells.Active, DedicatedCells.AlphaCode, DedicatedCells.Machine"
sql = sql + " FROM ProductMaster INNER JOIN DedicatedCells ON ProductMaster.PALPH = DedicatedCells.AlphaCode"
sql = sql + " WHERE (((ProductMaster.PRDNO)='" + Left(wrk, 7) + "') AND ((DedicatedCells.Active)=True));"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(sql)
Mach = ""
If rst.recordCount > 0 Then
rst.MoveFirst
Mach = rst!Machine
End If
GetLineFromDedicated = Mach
End Function
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
If Left$(Initforms$, 2) = "14" Then
DocName$ = "14" + Chr$(34) + " Process Sheet"
Else
DocName$ = "Process Sheet"
End If
PrimaryScreen$ = DocName$
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for what happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Filtered Parts"
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub Info_Click()
Call gatherinfo
Button246.SetFocus
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PartNumber_GotFocus()
' If itsaNull(PartName) = "" Then
'Info.Visible = True
'Else
'Info.Visible = False
'End If
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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 Programmer_LostFocus()
' a$ = Me![Programmer]
'
' If a$ = "SG" Or a$ = "CB" Or a$ = "ST" Or a$ = "KL" Then
' Checkupload = True
' Else
' Checkupload = False
' End If
End Sub
Private Sub PunchDie_AfterUpdate()
If (PunchDie = "!NONE!") Or (Trim$(PunchDie) = "") Then
PunchPressOption.Visible = False
PunchCount.Visible = False
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Text191_DblClick(Cancel As Integer)
DoCmd.OpenQuery "LogFileQ", acViewNormal, acReadOnly
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
Sub gatherinfo()
On Error Resume Next
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Set db = CurrentDb()
Part = Mid(PartNumber, 1, Len(PartNumber) - 1)
strSQL = "select * from ProductMaster WHERE PRDNO = '" & Part & "'"
Set rs = db.OpenRecordset(strSQL)
'Debug.Print rs![PRDNO] & " | " & rs![DESCP]
PartName = Trim(rs![DESCP])
End Sub
```
## What it does
**VBA Code Description**
=========================
This VBA code is a set of event handlers for an Access database application. It appears to be part of a tool for managing parts and related data. The code handles various button clicks, form interactions, and error handling.
### Button Click Events
#### `addPr_Click`
* Calls the `AddPartButton` subroutine when clicked.
* Sets the `NewPartName_Parm$` variable to "NEW".
#### `Button184_Click`
* Calls the `Add_Additional_Process` subroutine when clicked.
#### `Button190_Click`
* Quits the application when clicked, with error handling for unexpected errors.
* Displays an error message and continues execution.
#### `Button193_Click`
* Logs a new part to the database by calling the `LogFile` subroutine.
* Calls the `AddPartButton` subroutine.
#### `Button194_Click`
* Prints the current form's data when clicked, with error handling for unexpected errors.
* Opens the "Data Sheet Select" form and searches for a record with the same part number.
#### `Button196_Click`
* Checks if calculation status is valid before printing a report.
* Refreshes the application if necessary.
* Opens the corresponding report ("Process Sheet Print 14" or "Process Sheet Print") when clicked.
### Form Interactions
#### `search`
* Searches for a record with the same part number in the Machines table.
* Returns whether a match was found (fnd variable).
### Error Handling
The code uses error handling mechanisms to catch and display errors that occur during execution. It also includes custom exit buttons (`Err_Button190_Click`, `Err_Button194_Click`, and `Err_Button196_Click`) to handle specific error scenarios.
### Database Interactions
The code interacts with the database, creating and updating records in various tables (Machines, MachineNames, Process). It uses dynamic queries to retrieve data from these tables.
### Global Variables
Several global variables are used throughout the code:
* `dwncntL%`, `dwncntT%`, `dwncnt%`: integer counters
* `ToyClick%`, `ToyCaption%`, `Toys$(10)`: arrays and string variables

93
Forms/DS CNC.md Normal file
View File

@ -0,0 +1,93 @@
# DS CNC
Analysis generated on: 4/1/2025 4:11:32 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Elem5V1 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Elem5V2 | Elem5V2 (from [[Queries/DataSheetQ1]]) |
| Elem6A | Elem6A (from [[Queries/DataSheetQ1]]) |
| Field85 | Elem7V3 (from [[Queries/DataSheetQ1]]) |
| Field90 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field91 | Elem7V2 (from [[Queries/DataSheetQ1]]) |
| Field92 | Elem7A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**Code Description**
=====================
### Overview
This VBA code snippet is a procedure that is triggered when the `Form_Load` event occurs in an Access database. It checks for specific conditions and performs actions accordingly.
### Detailed Breakdown
#### Option Compare Database
The first line of code specifies the comparison order to use when comparing strings in this scope. In this case, it's set to "Database", which means that string comparisons will be performed according to the database's sorting order.
#### Private Sub Form_Load()
This is the procedure name and event handler for the `Form_Load` event, which occurs when a form is loaded.
#### On Error GoTo die
The `On Error` statement specifies an error handling routine that will be executed if any errors occur within the code. In this case, it jumps to the label `die`.
#### If IsNull(Me![PartNumber]) Then End
This line checks if the value in the `PartNumber` control on the form (`Me![PartNumber]`) is null (i.e., an empty string). If so, the procedure ends.
#### Exit Sub
The `Exit Sub` statement immediately exits the procedure without executing any further code.
#### HelpMe:
This label marks the beginning of a separate error handling block that will be executed if an error occurs. It consists of three commands:
* `DoCmd.SelectObject A_FORM, "DS CNC"`: Selects a form named "DS CNC" as the active form.
* `DoCmd.Close`: Closes the currently active form.
* `Exit Sub`: Exits the procedure.
#### die:
This label marks the end of the error handling block. The `Resume` statement resumes execution from this point if an error occurred in the preceding code.
### Purpose
The purpose of this code is to ensure that certain conditions are met before allowing the form to load. If these conditions are not met, it provides alternative actions and exits.

85
Forms/DS Hand Deburr.md Normal file
View File

@ -0,0 +1,85 @@
# DS Hand Deburr
Analysis generated on: 4/1/2025 4:04:21 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem2V2 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field469 | Elem3A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Hand Deburr"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**Code Description: Form Load Event Handler in VBA**
### Overview
This is a Visual Basic for Applications (VBA) code snippet that handles the form load event in a Microsoft Office application. Specifically, it's designed to work with forms and databases.
### Code Breakdown
#### `Option Compare Database`
* This line sets the comparison type for string comparisons in the VBA editor.
* It specifies that database order should be used for string comparisons.
* This can affect how strings are compared when using string data types (e.g., text fields).
#### `Private Sub Form_Load()`
* This is a subprocedure that runs automatically when the form loads.
* The `Form_Load` event is triggered after the form has been opened, and before any other events occur.
#### `On Error GoTo die`
* This line sets up error handling for the subroutine.
* If an error occurs while executing the code in this subroutine, the program will jump to the label `die`.
#### `If IsNull(Me![PartNumber]) Then End`
* This conditional statement checks if the value of the field named "PartNumber" in the form is null (i.e., empty or undefined).
* If it is null, the subroutine ends without performing any further actions.
#### `Exit Sub HelpMe: DoCmd.SelectObject A_FORM, "DS Hand Deburr" DoCmd.Close`
* This block of code performs several actions:
+ `HelpMe:`: This label serves as a catch-all error handler for the program.
+ `DoCmd.SelectObject A_FORM`: Selects an existing form named "DS Hand Deburr".
+ `DoCmd.Close`: Closes the selected form.
#### `die: Resume HelpMe`
* If an error occurs while executing the code in this subroutine, the `die` label will be reached.
* The `Resume` statement then transfers control back to the `HelpMe:` label.
### Context and Usage
This code is likely used in a Microsoft Office application (such as Excel or Access) that requires handling form load events. The specific actions performed in this subroutine depend on the requirements of the application, but they seem to be related to selecting an existing form and closing it.

90
Forms/DS Laser.md Normal file
View File

@ -0,0 +1,90 @@
# DS Laser
Analysis generated on: 4/1/2025 4:03:29 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem3V1 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Elem3V2 | Elem3V2 (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Laser"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**Code Description**
=====================
### VBA Code Overview
This VBA code is written in an Access database and appears to be a form load event handler. It contains two primary sections: error handling and the main logic.
### Error Handling Section
```markdown
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
```
This section defines an error handling mechanism using the `On Error` statement, which redirects control to the labeled block of code (`die`) when an error occurs.
* The first line, `Option Compare Database`, specifies that string comparisons in this module should be performed in database order.
* The `Private Sub Form_Load()` statement defines the event handler for the form load event. This event is triggered when the form is loaded into memory after it has been opened from a database.
* Inside the event handler, there's an error handling mechanism using `On Error GoTo die`. If any errors occur during the execution of this code, control will be transferred to the block labeled `die`.
* The subsequent line checks if the `PartNumber` field on the form is null (`IsNull(Me![PartNumber])`). If it is null, the code attempts to exit the subroutine using the `End` statement.
### Main Logic Section
```markdown
HelpMe:
DoCmd.SelectObject A_FORM, "DS Laser"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
```
This section contains the main logic of the event handler:
* The block labeled `HelpMe` contains two statements that interact with other forms in the database.
* `DoCmd.SelectObject A_FORM, "DS Laser"` selects an object (in this case, a form named "DS Laser") using the `DoCmd.SelectObject` method. The parameter `A_FORM` is likely a constant or variable representing the current form's ID.
* `DoCmd.Close` closes the selected form using the `DoCmd.Close` method.
* The block labeled `die:` contains two statements that catch and handle errors when they occur:
* `Resume HelpMe`: This statement transfers control back to the `HelpMe` block of code if an error occurs. This allows the code to recover from errors by re-executing the code in this section.
### Conclusion
In summary, this VBA code handles form load events in an Access database. It checks for a null `PartNumber` field on the current form and attempts to close another form named "DS Laser" if necessary. The code includes robust error handling using the `On Error GoTo die` statement to ensure that it can recover from errors and resume execution as intended.

104
Forms/DS Misc Weld.md Normal file
View File

@ -0,0 +1,104 @@
# DS Misc Weld
Analysis generated on: 4/1/2025 4:10:14 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Field97 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Field98 | Elem1V2 (from [[Queries/DataSheetQ1]]) |
| Field100 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field105 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field140 | Elem6A (from [[Queries/DataSheetQ1]]) |
| Field144 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Field158 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field161 | Elem8V2 (from [[Queries/DataSheetQ1]]) |
| Field164 | Elem8V3 (from [[Queries/DataSheetQ1]]) |
| Field167 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
| Field170 | Elem9V2 (from [[Queries/DataSheetQ1]]) |
| Field173 | Elem9V3 (from [[Queries/DataSheetQ1]]) |
| Field179 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field180 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field196 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Field197 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Field198 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Field202 | Elem6V2 (from [[Queries/DataSheetQ1]]) |
| Field211 | Elem10V1 (from [[Queries/DataSheetQ1]]) |
| Field214 | Elem10V2 (from [[Queries/DataSheetQ1]]) |
| Field217 | Elem10V3 (from [[Queries/DataSheetQ1]]) |
| Field220 | Elem11V1 (from [[Queries/DataSheetQ1]]) |
| Field223 | Elem11V2 (from [[Queries/DataSheetQ1]]) |
| Field226 | Elem11V3 (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**Code Description**
=====================
### Option Compare Database
This line specifies that string comparisons in the code should be performed using the database's order. This means that even if two strings are treated as equal by the .NET framework, they may not be considered equal by this specific VBA application.
### Private Sub Form_Load()
This is a subroutine named `Form_Load` which is called when the form is loaded. It contains three main sections: error handling, form validation, and default action.
#### On Error GoTo die
If an error occurs in the code within the `Form_Load` subroutine, it will be caught by this line and the program execution will continue to the next section labeled "die".
#### If IsNull(Me![PartNumber]) Then
This checks if the `PartNumber` field on the form is null. The `Me` keyword refers to the current object (in this case, the form). The `[PartNumber]` syntax is used to access a control on the form by its name.
If the `PartNumber` field is null, the program will exit immediately using the `End` statement.
#### Exit Sub
This line exits the subroutine and returns the program execution to the next event or command. In this case, it's likely that the program has finished loading and there are no further actions required.
### HelpMe:
This section contains two subroutines: `DoCmd.SelectObject` and `DoCmd.Close`. These subroutines interact with the database and are used to manage forms.
* `DoCmd.SelectObject A_FORM, "DS CNC"`: This line selects an object named "DS CNC" from the database. The `A_FORM` argument specifies that a form should be selected.
* `DoCmd.Close`: This line closes the currently active form. In this case, it's closing the form with the name "DS CNC".
* `Exit Sub`: After closing the form, the program exits the subroutine and returns to the next event or command.
### die:
This section contains a single instruction: `Resume HelpMe`. If an error occurs in the code within the `Form_Load` subroutine, this line will resume execution from the `HelpMe` label. This effectively "catches" any errors that occur during form loading and takes alternative action instead.
In summary, this VBA code is responsible for checking if a form has been loaded successfully, handling any potential errors by catching them and taking alternative actions, and then selecting and closing another form in the database if necessary.

93
Forms/DS MultShear.md Normal file
View File

@ -0,0 +1,93 @@
# DS MultShear
Analysis generated on: 4/1/2025 4:11:23 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1V1 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2V2 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Elem2V3 | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Elem3V1 | Elem5A (from [[Queries/DataSheetQ1]]) |
| Elem3V2 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Elem3V3 | Elem6A (from [[Queries/DataSheetQ1]]) |
| Elem4V1 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem8A (from [[Queries/DataSheetQ1]]) |
| Elem9A | Elem10A (from [[Queries/DataSheetQ1]]) |
| Elem9V2 | Elem11A (from [[Queries/DataSheetQ1]]) |
| Field412 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field413 | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field414 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field415 | Elem3A (from [[Queries/DataSheetQ1]]) |
| Field423 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field429 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field441 | Elem9A (from [[Queries/DataSheetQ1]]) |
| Field446 | Elem9V2 (from [[Queries/DataSheetQ1]]) |
| Field449 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
| Field450 | Elem10V1 (from [[Queries/DataSheetQ1]]) |
| Field453 | Elem11V2 (from [[Queries/DataSheetQ1]]) |
| Field455 | Elem11V1 (from [[Queries/DataSheetQ1]]) |
| Field469 | Elem12A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS MultShear"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
### VBA Code Description: `Form_Load` Event Handler
#### Overview
This VBA code snippet is an event handler for the `Load` event of a form in Microsoft Access. The code is responsible for initializing certain settings and behavior when the form is loaded.
#### Key Functions:
1. **Error Handling**: The code uses `On Error GoTo die` to catch any errors that occur during execution. If an error occurs, it redirects the control flow to the labeled `die` label.
2. **Null Check**: It checks if the `PartNumber` field in the form is null or undefined using `IsNull(Me![PartNumber])`. If it is, the code skips the rest of the subroutine and exits.
3. **Default Form Opening**: The code opens a new instance of the "DS MultShear" form using `DoCmd.SelectObject A_FORM, "DS MultShear"` and closes the current active window using `DoCmd.Close`.
4. **Exiting Early**: If an error occurs or the `PartNumber` field is null, the code exits early from the subroutine.
#### Step-by-Step Explanation:
1. The code starts by declaring that string comparisons will be performed in database order using `Option Compare Database`.
2. It then defines a private subroutine called `Form_Load`, which is the event handler for the `Load` event of the form.
3. Inside the subroutine, it checks if there's an error and, if so, skips to the `die` label.
4. Next, it checks if the `PartNumber` field in the form is null or undefined. If so, it exits the subroutine using `End`.
5. The code then opens a new instance of the "DS MultShear" form using `DoCmd.SelectObject A_FORM, "DS MultShear"` and closes the current active window using `DoCmd.Close`.
6. If an error occurs or the `PartNumber` field is null, it skips to the `die` label and resumes execution from there.
#### Example Use Case:
This code can be used in a Microsoft Access application where you want to ensure that certain actions are performed when a form is loaded. For instance, it might be used in an inventory management system to check if a part number is required before opening the "DS MultShear" form.
### Code Improvements Suggestions
* Consider adding more error handling or logging mechanisms to provide better insights into what's causing errors.
* Refactor the code to make it more concise and readable by breaking it down into smaller, more focused subroutines.
* Use meaningful variable names instead of abbreviations like `A_FORM` and `Me![PartNumber]`.

111
Forms/DS Paper Peel.md Normal file
View File

@ -0,0 +1,111 @@
# DS Paper Peel
Analysis generated on: 4/1/2025 4:06:22 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Field97 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Field105 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field140 | Elem6A (from [[Queries/DataSheetQ1]]) |
| Field144 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Field235 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Field271 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field272 | Elem9A (from [[Queries/DataSheetQ1]]) |
| Field273 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Field274 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Field275 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field276 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field277 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
| Field280 | Elem1V2 (from [[Queries/DataSheetQ1]]) |
| Field281 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field283 | Elem2V2 (from [[Queries/DataSheetQ1]]) |
| Field284 | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field288 | Elem5V2 (from [[Queries/DataSheetQ1]]) |
| Field289 | Elem6V2 (from [[Queries/DataSheetQ1]]) |
| Field306 | Elem10A (from [[Queries/DataSheetQ1]]) |
| Field307 | Elem10V1 (from [[Queries/DataSheetQ1]]) |
| Field308 | Elem7V2 (from [[Queries/DataSheetQ1]]) |
| Field309 | Elem8V2 (from [[Queries/DataSheetQ1]]) |
| Field310 | Elem9V2 (from [[Queries/DataSheetQ1]]) |
| Field311 | Elem10V2 (from [[Queries/DataSheetQ1]]) |
| Field316 | Elem11V1 (from [[Queries/DataSheetQ1]]) |
| Field317 | Elem11A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
========================
### Overview
This VBA code is written in Access and is attached to a form load event. It checks if the `PartNumber` field of the form is null, and if so, it exits the subroutine.
### Breakdown
#### Line 1: `Option Compare Database`
* This line specifies that string comparisons within this subroutine should be performed according to the database's collation order.
#### Line 5-6: `Private Sub Form_Load()`
* This line begins the definition of a private subroutine named `Form_Load`, which is attached to the form load event.
* The `On Error GoTo die` statement sets up an error handling mechanism, where if an error occurs within this subroutine, control will be transferred to the `die:` label.
#### Line 7: `If IsNull(Me![PartNumber]) Then`
* This line checks if the value in the `PartNumber` field of the form (`Me!`) is null.
* The `IsNull()` function returns `True` if the specified object is null, and `False` otherwise.
#### Line 8-10: `End If Exit Sub HelpMe:`
* If the `PartNumber` field is null, this line exits the subroutine immediately using the `Exit Sub` statement.
* However, due to a syntax error, the second part of the `If` statement (`HelpMe`) is not properly defined and will be skipped.
#### Line 11-12: `DoCmd.SelectObject A_FORM, "DS CNC"` and `DoCmd.Close`
* This line uses the `DoCmd` object to select an object (in this case, a form named "DS CNC") from the current database.
* The `SelectObject()` method is used to create a new recordset that contains the selected object.
* The second parameter `"DS CNC"` specifies the name of the form to be selected.
#### Line 13: `Exit Sub`
* This line exits the subroutine, effectively ending its execution.
#### Line 14-15: `die:`
* This label is the target for error handling, and will be executed if an error occurs within the subroutine.
* The `Resume HelpMe` statement transfers control back to the first line of the code after skipping the null check (`End If`) due to a syntax error.
**Note:** There is a syntax error in the code. The correct syntax would be `Exit Sub HelpMe:` instead of `End If Exit Sub HelpMe:`. However, even with this correction, the second part of the `If` statement will still not work as intended.

82
Forms/DS Pedestal.md Normal file
View File

@ -0,0 +1,82 @@
# DS Pedestal
Analysis generated on: 4/1/2025 4:11:15 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Field441 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Field443 | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field450 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field451 | Elem2V2 (from [[Queries/DataSheetQ1]]) |
| Field456 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field465 | Elem3A (from [[Queries/DataSheetQ1]]) |
| Field466 | Elem4A (from [[Queries/DataSheetQ1]]) |
| Field469 | Elem5A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Pedestal"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code is used to handle the `Form_Load` event in an Access database application. The code ensures that a form is loaded correctly and prevents any errors from occurring.
### Key Functions
#### 1. Error Handling and Comparison Order
The first line, `Option Compare Database`, specifies that string comparisons should be performed using database order (`DB`). This means that when comparing strings, the database will perform an exact match, rather than a case-insensitive or lexicographic comparison.
#### 2. Preventing Empty Form Loads
In the `Form_Load` event, the code checks if the `PartNumber` field in the form is null (`IsNull(Me![PartNumber])`). If it is null, the code skips the rest of the subroutine and exits using the `End` statement.
This prevents the form from loading with a blank value in the `PartNumber` field, which could potentially cause errors or issues with the application's functionality.
#### 3. Loading a Form
The next line, `HelpMe: DoCmd.SelectObject A_FORM, "DS Pedestal"`, loads a specific form named "DS Pedestal". The `DoCmd.SelectObject` method is used to select and load an object in the database.
However, this line has a flaw. By using the same label (`HelpMe`) as the error handler (`die: Resume HelpMe`), it creates a loop where the code will jump back to the error handler if an error occurs. This means that the form will never be loaded correctly.
#### 4. Closing and Exiting
The line `DoCmd.Close` closes the currently active form, but this is unnecessary since the form has already been loaded by the previous line.
Finally, the `Exit Sub` statement exits the subroutine without proceeding to any further code.
#### 5. Error Handling and Looping
In the event of an error (`die: Resume HelpMe`), the code jumps back to the error handler using the same label as the main loop (`HelpMe`). This creates a loop where the code will continue to jump back and forth between the two labels, preventing any actual form loading.
Overall, this VBA code is poorly designed due to the looping issue caused by using the same label for both the main loop and the error handler.

View File

@ -0,0 +1,150 @@
# DS Pem Press Manual
Analysis generated on: 4/1/2025 4:11:05 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Text269 | Elem7V2 (from [[Queries/DataSheetQ1]]) |
| Text270 | Elem7V3 (from [[Queries/DataSheetQ1]]) |
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem7A | Elem7A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Field99 | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field101 | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Elem6A | Elem6A (from [[Queries/DataSheetQ1]]) |
| Elem2V1 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field107 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Elem4V1 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Elem5V1 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Elem6V1 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Elem7V1 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field134 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field135 | Elem8A (from [[Queries/DataSheetQ1]]) |
| txtElem2 | Elem9A (from [[Queries/DataSheetQ1]]) |
| txtElem1 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Current()
If Me!Operation <> "AUTO" Then
lblElem1.Visible = True
lblElem2.Visible = True
lblElem3.Visible = True
lblElem4.Visible = True
lblElem5.Visible = True
txtElem1.Visible = True
txtElem2.Visible = True
Else
lblElem1.Visible = False
lblElem2.Visible = False
lblElem3.Visible = False
lblElem4.Visible = False
lblElem5.Visible = False
txtElem1.Visible = False
txtElem2.Visible = False
End If
End Sub
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Pem Press Manual"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code is written for Microsoft Access and appears to be part of a form's event handling. It controls the visibility of various controls on a form based on the value of a `PartNumber` field.
### Form_Current Sub Procedure
-------------------------------
```markdown
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Current()
If Me!Operation \u003c\u003e "AUTO" Then
lblElem1.Visible = True
lblElem2.Visible = True
lblElem3.Visible = True
lblElem4.Visible = True
lblElem5.Visible = True
txtElem1.Visible = True
txtElem2.Visible = True
Else
lblElem1.Visible = False
lblElem2.Visible = False
lblElem3.Visible = False
lblElem4.Visible = False
lblElem5.Visible = False
txtElem1.Visible = False
txtElem2.Visible = False
End If
End Sub
```
This code is triggered when the form's current value changes. It checks the value of the `Operation` field and hides or shows various labels and text boxes based on this value.
* If the operation is not "AUTO", it displays five labels (`lblElem1` to `lblElem5`) and two text boxes (`txtElem1` and `txtElem2`).
* If the operation is "AUTO", it hides all the previously displayed controls, making them invisible.
### Form_Load Sub Procedure
------------------------------
```markdown
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
die:
Resume HelpMe
```
This code is executed when the form loads. It has two main purposes:
* **Validation**: It checks if the `PartNumber` field is null. If it is, the procedure ends and the application terminates.
* **Error Handling**: If an error occurs during the validation process, it jumps to a label called "HelpMe" using the `Resume` statement.
### HelpMe Label
-----------------
```markdown
DoCmd.SelectObject A_FORM, "DS Pem Press Manual"
DoCmd.Close
Exit Sub
```
This code appears to be part of an error handling mechanism. When the application encounters an error while validating the `PartNumber` field, it:
* **Opens a Specific Form**: It selects and opens another form called "DS Pem Press Manual".
* **Closes the Current Form**: It closes the current form.
* **Exits the Procedure**: It ends the current procedure.
The purpose of this code is unclear without more context. However, it seems to be an attempt to handle errors by switching to a different form or terminating the application.

111
Forms/DS Polish.md Normal file
View File

@ -0,0 +1,111 @@
# DS Polish
Analysis generated on: 4/1/2025 4:10:56 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Field97 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Field100 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field105 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field140 | Elem6A (from [[Queries/DataSheetQ1]]) |
| Field144 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Field179 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field235 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Field271 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field272 | Elem9A (from [[Queries/DataSheetQ1]]) |
| Field273 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Field274 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Field275 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field276 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field277 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code is a subroutine attached to the `Form_Load` event in Access. It is designed to handle the loading of a form when the application loads.
### Code Breakdown
#### Option Compare Database
The first line, `Option Compare Database`, specifies that string comparisons should be done using the database's collation order (also known as locale-specific sorting). This ensures that strings are sorted according to the specific character set and cultural settings used in the database.
#### Private Sub Form_Load()
This is the name of the subroutine that will be executed when the form is loaded. The `Private` access modifier means that this subroutine can only be accessed within the current module.
#### On Error GoTo die
The `On Error GoTo` statement sets up an error-handling mechanism. If an error occurs in the code, it will transfer control to the label "die".
#### If IsNull(Me![PartNumber]) Then End
This line checks if the value of the `PartNumber` field on the current form is null (`IsNull` returns `True` for a null value). If so, the subroutine ends.
#### HelpMe:
```vba
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
```
This section of code is skipped if an error occurs in the previous line. It performs two actions:
* `DoCmd.SelectObject A_FORM, "DS CNC"`: Selects a new form object with the name "DS CNC" and assigns it to the current form.
* `DoCmd.Close`: Closes the currently open document (which is now replaced by the newly selected form).
* `Exit Sub`: Exits the subroutine.
#### die:
This label marks the point where execution will resume if an error occurs in the previous line. The code after this label (`Resume HelpMe`) transfers control back to the "HelpMe:" section of the code, allowing it to continue executing normally.
### Purpose and Usage
In summary, this VBA code is designed to load a specific form ("DS CNC") when the application loads. It checks if the `PartNumber` field on the current form is null before proceeding. If an error occurs during this check, it will transfer control to the "HelpMe:" section of the code and attempt to load the new form.
### Best Practices
This code follows standard VBA best practices:
* Uses meaningful variable names (`A_FORM` instead of a hardcoded value)
* Includes descriptive comments (although they are not necessary in this simple case)
* Handles errors using `On Error GoTo`
* Uses `Private` access modifiers to restrict subroutine access
However, consider adding more error-handling code or logging mechanisms to make the application more robust and reliable.

90
Forms/DS PressBrake.md Normal file
View File

@ -0,0 +1,90 @@
# DS PressBrake
Analysis generated on: 4/1/2025 4:10:45 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem7A | Elem7A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Field99 | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field101 | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Elem6A | Elem6A (from [[Queries/DataSheetQ1]]) |
| Elem2V1 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field107 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Elem4V1 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Elem5V1 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Elem6V1 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Elem7V1 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Field134 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field135 | Elem8A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS PressBrake"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
### VBA Code Description
#### Overview
This is a VBA (Visual Basic for Applications) code snippet that is triggered when the `Form_Load` event occurs. The purpose of this code is to ensure that a specific form, "DS PressBrake," remains open on a database application.
#### Key Functionality
* **Error Handling**: The code uses `Option Compare Database` to specify database order for string comparisons, which ensures consistent case-insensitive comparisons across the application.
* **Part Number Validation**: Upon form load, it checks if the `PartNumber` field is null. If it is, the subroutine ends, indicating that the required information is missing and preventing any potential errors or unexpected behavior.
#### Detailed Breakdown
1. **Private Sub Form_Load()**:
* This line specifies a private subroutine named `Form_Load`. In VBA, this event is triggered when a form is loaded into an application.
2. **On Error GoTo die**:
* This statement sets the error handling strategy to stop execution at the first occurrence of an error and jump to the label `die`.
3. **If IsNull(Me![PartNumber]) Then**:
* Within the form load event, this conditional statement checks whether the value associated with the control "PartNumber" in the current object (usually a form) is null.
4. **End**:
* If `Me.PartNumber` is null, the subroutine terminates immediately using the `End` keyword.
5. **HelpMe:**
* This line resumes execution from the label `HelpMe`.
6. **DoCmd.SelectObject A_FORM, "DS PressBrake"**:
* The `DoCmd.SelectObject` method is used to select an object with a specified name or ID in a database application.
* Here, it selects and opens a form named "DS PressBrake."
7. **DoCmd.Close**:
* After selecting the desired form, this line closes the currently active form, allowing the selected form ("DS PressBrake") to take its place.
8. **Exit Sub**:
* The subroutine exits without performing any additional actions after successfully opening and closing the required form.
#### Error Handling Flow
The code handles errors in two steps:
* If an error occurs during the execution of the `Form_Load` event, the VBA interpreter stops at the first occurrence of the error (`die`) and then jumps to the error-handling routine (`HelpMe`).
* The `HelpMe:` label is where any necessary recovery or cleanup actions should be placed. In this example, it simply resumes execution from that point, which in turn leads back to opening the desired form.
* If the required information (in this case, a valid part number) is missing, the program ends prematurely.
#### Summary
This VBA code ensures that when its associated form loads, if necessary information (like `PartNumber`) is missing, it opens an alternative form named "DS PressBrake" to address the issue. The code uses error handling and validation checks to minimize potential problems caused by uncomplete data in the database application.

100
Forms/DS Salvagnini.md Normal file
View File

@ -0,0 +1,100 @@
# DS Salvagnini
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Laser"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code is a part of an Access application and is triggered when the `Form_Load` event occurs. It checks for specific conditions related to the form's settings and takes corrective actions.
### Key Sections
#### Option Compare Database
---------------------------
* This line sets the comparison order for string values in the database.
* The `Option Compare Database` statement tells Access to use its own internal string comparison rules, rather than the default culture-specific rules.
* This is done to ensure consistent and accurate comparisons of text data across different regions and cultures.
#### Sub Form_Load
------------------
* **Private Sub**: Indicates that this subroutine is private and can only be accessed within the same module.
* `Form_Load` event: This line specifies that the code is attached to the `Form Load` event, which is triggered when the form is initialized or opened.
* `On Error GoTo die`: Sets the error handling trap for any exceptions that occur during the execution of this subroutine. If an error occurs, the control jumps to the `die:` label.
#### Conditional Checks
----------------------
### Check for Null PartNumber
```vb
If IsNull(Me![PartNumber]) Then
End
End If
```
* This code checks if the form's `PartNumber` field is null.
* If it is null, the subroutine ends immediately using the `End` statement.
#### Resume HelpMe
```vb
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Laser"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
```
### Default Action: Close and Open DS Laser Form
* The `Resume HelpMe` instruction redirects the program flow to the `HelpMe:` label.
* Inside the `HelpMe:` block:
* `DoCmd.SelectObject A_FORM, "DS Laser"`: Opens a new instance of the specified form (`"DS Laser"`) in the current database.
* `DoCmd.Close`: Closes the currently open document (if any).
* The subroutine ends using `Exit Sub`.
### Error Handling: die:
* If an error occurs during the execution of this code, it is caught by the `die:` label.
* This instruction simply resumes the normal program flow from where the error occurred.
**In summary**, this VBA code checks for a null `PartNumber` field in the form's settings and takes corrective actions. If the `PartNumber` is null, it ends immediately. Otherwise, it closes any open document and opens a new instance of the "DS Laser" form. The code also includes error handling to ensure that the program continues running smoothly after encountering an exception.

View File

@ -0,0 +1,90 @@
# DS Shake And Break
Analysis generated on: 4/1/2025 4:05:07 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Field469 | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem1V1 | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2V1 | Elem2A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Hand Deburr"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
=========================
### Overview
This VBA code is written in Access and is used to handle the form load event. It ensures that when a form is loaded, certain actions are taken to prevent errors.
### Breakdown of the Code
#### Option Compare Database
The first line sets the option for string comparisons to use the database order. This means that when comparing strings, the code will use the collation sequence defined in the database, which can affect how strings are compared and sorted.
#### Private Sub Form_Load()
This is a subroutine declared as private, meaning it can only be accessed within the same module. The `Form_Load` event is triggered whenever a form is loaded.
#### On Error GoTo die
The `On Error` statement specifies that if an error occurs in the code, the control should jump to the label `die`.
#### If IsNull(Me![PartNumber]) Then End
This checks if the value of the field named "PartNumber" on the current form is null or empty. If it is, the subroutine will exit immediately using the `End` statement.
#### DoCmd.SelectObject A_FORM, "DS Hand Deburr"
If the part number field is not null or empty, this line uses the `DoCmd.SelectObject` method to open a form named "DS Hand Deburr". The `A_FORM` parameter refers to the current form.
#### DoCmd.Close
After opening the other form, this line closes the current form using the `DoCmd.Close` method.
#### Exit Sub
The `Exit Sub` statement exits the subroutine after all code within it has been executed.
#### HelpMe: ... (commented out)
This is a commented-out line that jumps to the label named "HelpMe" if an error occurs. It's likely that this was used for debugging purposes but has been disabled.
#### die:
This is the label where the control should jump if an error occurs, following the `On Error GoTo` statement.
### Purpose
The purpose of this code is to ensure that when a form is loaded, certain actions are taken to prevent errors. Specifically, it checks if the part number field is null or empty and handles this situation by opening another form and closing the current one. If an error occurs, it jumps to a labeled point for further debugging.

106
Forms/DS Shear.md Normal file
View File

@ -0,0 +1,106 @@
# DS Shear
Analysis generated on: 4/1/2025 4:10:37 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem1V1 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Elem1V2 | Elem1V2 (from [[Queries/DataSheetQ1]]) |
| Elem1V3 | Elem1V3 (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem2V1 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Elem2V2 | Elem2V2 (from [[Queries/DataSheetQ1]]) |
| Elem2V3 | Elem2V3 (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem3V1 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Elem3V2 | Elem3V2 (from [[Queries/DataSheetQ1]]) |
| Elem3V3 | Elem3V3 (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem4V1 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Elem4V2 | Elem4V2 (from [[Queries/DataSheetQ1]]) |
| Elem4V3 | Elem4V3 (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Elem5V1 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Elem5V2 | Elem5V2 (from [[Queries/DataSheetQ1]]) |
| Elem5V3 | Elem5V3 (from [[Queries/DataSheetQ1]]) |
| Elem6A | Elem6A (from [[Queries/DataSheetQ1]]) |
| Elem6V1 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Elem6V2 | Elem6V2 (from [[Queries/DataSheetQ1]]) |
| Elem6V3 | Elem6V3 (from [[Queries/DataSheetQ1]]) |
| Field362 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Field364 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
| Elem7V2 | Elem7V2 (from [[Queries/DataSheetQ1]]) |
| Elem7V3 | Elem7V3 (from [[Queries/DataSheetQ1]]) |
| Elem8A | Elem8A (from [[Queries/DataSheetQ1]]) |
| Elem8V1 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Elem8V2 | Elem8V2 (from [[Queries/DataSheetQ1]]) |
| Elem8V3 | Elem8V3 (from [[Queries/DataSheetQ1]]) |
| Elem9A | Elem9A (from [[Queries/DataSheetQ1]]) |
| Elem9V1 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
| Elem9V2 | Elem9V2 (from [[Queries/DataSheetQ1]]) |
| Elem9V3 | Elem9V3 (from [[Queries/DataSheetQ1]]) |
| Elem10A | Elem10A (from [[Queries/DataSheetQ1]]) |
| Elem10V1 | Elem10V1 (from [[Queries/DataSheetQ1]]) |
| Elem10V2 | Elem10V2 (from [[Queries/DataSheetQ1]]) |
| Text415 | Elem11A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Shear"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description: Form Load Event Handler**
=====================================================
### Overview
This VBA code snippet is attached to the `Form_Load` event of a Microsoft Access database form. It serves as a handler for the event that occurs when the form loads.
### Purpose
The primary purpose of this code is to ensure that the form is not loaded if it lacks a required input, specifically the `PartNumber`.
### Key Features
* **Error Handling**: The code uses `On Error GoTo die` to catch any errors that might occur during execution. This ensures that the program doesn't crash and provides an alternative path for handling errors.
* **Null Check**: It checks if the `PartNumber` field is null (`IsNull`) before proceeding with the rest of the code.
* **Exit Sub Statement**: If the `PartNumber` is null, the code exits the subroutine immediately using the `End` statement. This prevents further execution and ensures that the form does not load.
* **HelpMe Label**: The code uses a `DoCmd.SelectObject A_FORM, "DS Shear"` command to close an existing form named "DS Shear" before exiting. This suggests that there might be some other form-related functionality tied to this event handler.
### Step-by-Step Explanation
1. When the form loads, the `Form_Load` event is triggered.
2. The code checks for any errors using `On Error GoTo die`. If an error occurs, it redirects control to the `die` label.
3. It then verifies if the `PartNumber` field contains a null value (`IsNull Me![PartNumber]`). If it's null, the program exits using the `End` statement.
4. After checking for errors and handling the case where `PartNumber` is null, the code executes a `DoCmd.SelectObject A_FORM, "DS Shear"` command to close an existing form named "DS Shear".
5. If no errors occur or if the `PartNumber` field has a valid value, the program exits normally using the `Exit Sub` statement.
### Conclusion
This VBA code provides a robust and error-free way to handle the loading of a specific form in Microsoft Access. By integrating null checks, error handling, and exit statements, it ensures that the form loads successfully only if all required inputs are present.

92
Forms/DS Spot Weld.md Normal file
View File

@ -0,0 +1,92 @@
# DS Spot Weld
Analysis generated on: 4/1/2025 4:10:05 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem4A | Elem4A (from [[Queries/DataSheetQ1]]) |
| Elem5A | Elem5A (from [[Queries/DataSheetQ1]]) |
| Field97 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Field98 | Elem1V2 (from [[Queries/DataSheetQ1]]) |
| Field100 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Field105 | Elem3V1 (from [[Queries/DataSheetQ1]]) |
| Field115 | Elem4V1 (from [[Queries/DataSheetQ1]]) |
| Field120 | Elem5V1 (from [[Queries/DataSheetQ1]]) |
| Field127 | Elem6V2 (from [[Queries/DataSheetQ1]]) |
| Field139 | Elem6V1 (from [[Queries/DataSheetQ1]]) |
| Field140 | Elem6A (from [[Queries/DataSheetQ1]]) |
| Field144 | Elem7A (from [[Queries/DataSheetQ1]]) |
| Field158 | Elem8V1 (from [[Queries/DataSheetQ1]]) |
| Field161 | Elem8V2 (from [[Queries/DataSheetQ1]]) |
| Field164 | Elem8V3 (from [[Queries/DataSheetQ1]]) |
| Field167 | Elem9V1 (from [[Queries/DataSheetQ1]]) |
| Field170 | Elem9V2 (from [[Queries/DataSheetQ1]]) |
| Field173 | Elem9V3 (from [[Queries/DataSheetQ1]]) |
| Field179 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field180 | Elem8A (from [[Queries/DataSheetQ1]]) |
| Field183 | Elem7V2 (from [[Queries/DataSheetQ1]]) |
| Field185 | Elem7V1 (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS CNC"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**VBA Code Description**
=========================
### Purpose
This VBA code is designed to handle the loading of a specific form in an Access database. It checks for the presence of a mandatory field (`PartNumber`) and provides error handling if it's missing.
### Detailed Explanation
#### 1. Option Compare Database
The first line, `Option Compare Database`, specifies that string comparisons should be performed according to the database collation order. This is an important consideration when working with data in Access databases.
#### 2. Form_Load Subroutine
The `Form_Load` subroutine is a standard event handler in VBA that gets triggered when a form loads.
#### 3. Error Handling and Mandatory Field Check
Inside the `Form_Load` subroutine, there are two main sections:
* **Error Handling:** The `On Error GoTo die` statement specifies that if an error occurs during the execution of the code within this subroutine, it should be caught and handled using the `die:` label. This prevents the program from crashing.
* **Mandatory Field Check:** The following lines check if the value in the `PartNumber` field (represented by `Me![PartNumber]`) is null or empty (`IsNull(Me![PartNumber])`). If it is, the subroutine executes the code within the `End If` block, effectively ending the subroutine and preventing any further execution.
#### 4. Selecting and Closing a Form
The following lines of code are used to select and close another form in the database:
* `DoCmd.SelectObject A_FORM, "DS CNC"`: This line selects an object (in this case, a form named "DS CNC") using the `DoCmd` object.
* `DoCmd.Close`: After selecting the other form, this line closes the selected form.
#### 5. Error Handling Catch
The final label (`die:`) serves as a catch-all for any unhandled errors that may occur during the execution of the code within the `Form_Load` subroutine. When an error is encountered and it's not caught by the previous `On Error GoTo die` statement, the program jumps to this label, allowing it to continue running while still providing some level of error management.
**In Summary**
This VBA code ensures that a specific form loads properly in an Access database by checking for the presence of a mandatory field (`PartNumber`). If the field is missing, it triggers an error and tries to load another form in an attempt to mitigate any issues.

95
Forms/DS Timesaver.md Normal file
View File

@ -0,0 +1,95 @@
# DS Timesaver
Analysis generated on: 4/1/2025 4:09:26 PM
---
## Record Source
- [[Queries/DataSheetQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/DataSheetQ1]]) |
| Operation | Operation (from [[Queries/DataSheetQ1]]) |
| Elem1A | Elem1A (from [[Queries/DataSheetQ1]]) |
| Paperwork | Paperwork (from [[Queries/DataSheetQ1]]) |
| TotalSelectTime | TotalSelectTime (from [[Queries/DataSheetQ1]]) |
| StandardMinutes/part | StandardMinutes/part (from [[Queries/DataSheetQ1]]) |
| pf&d | pf&d (from [[Queries/DataSheetQ1]]) |
| StandardHours/part | StandardHours/part (from [[Queries/DataSheetQ1]]) |
| StandardParts | StandardParts (from [[Queries/DataSheetQ1]]) |
| Elem1V1 | Elem1V1 (from [[Queries/DataSheetQ1]]) |
| Elem2A | Elem2A (from [[Queries/DataSheetQ1]]) |
| Elem2V2 | Elem2V1 (from [[Queries/DataSheetQ1]]) |
| Elem3A | Elem3A (from [[Queries/DataSheetQ1]]) |
| Elem1V2 | Elem1V2 (from [[Queries/DataSheetQ1]]) |
| Field469 | Elem4A (from [[Queries/DataSheetQ1]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
On Error GoTo die
If IsNull(Me![PartNumber]) Then
End
End If
Exit Sub
HelpMe:
DoCmd.SelectObject A_FORM, "DS Timesaver"
DoCmd.Close
Exit Sub
die:
Resume HelpMe
End Sub
```
## What it does
**Code Description**
=====================
### Overview
This VBA code snippet is a procedure that handles the `Form_Load` event in an Access application. The purpose of this code is to ensure that certain conditions are met before allowing the form to load.
### Breakdown
#### Option Compare Database
* This line specifies the comparison order for string comparisons in the current module.
* By setting it to `Database`, the code ensures that string comparisons are performed in a case-insensitive manner, taking into account database-specific collation settings.
#### Private Sub Form_Load()
* This line defines the procedure that will be executed when the form loads.
#### On Error GoTo die
* The `On Error` statement sets up an error-handling mechanism.
* When an error occurs in the code within the block, control is transferred to the label `die`.
#### If IsNull(Me![PartNumber]) Then End
* This line checks if the value of the `PartNumber` field in the current form's recordset is null or empty.
* If it is null, the procedure exits using the `End` statement.
#### DoCmd.SelectObject A_FORM, "DS Timesaver"
* This line uses the `DoCmd` object to select an existing record in the database based on the specified form and record name (`"DS Timesaver"`).
* The `A_FORM` parameter specifies that the record should be selected from the current form.
#### DoCmd.Close
* After selecting a new record, this line closes the currently open document.
#### Exit Sub
* This statement exits the procedure, indicating that no further code needs to be executed after the conditions have been met.
#### die:
* The `die` label is defined earlier in the code as the error-handling destination.
* When an error occurs, control transfers to this label, which contains the alternative code path.
### Purpose
The primary purpose of this code is to ensure that a specific record (`DS Timesaver`) is present in the database before allowing the form to load. If the required record does not exist, the form will exit without loading.
By using an error-handling mechanism and carefully selecting which actions to perform when an error occurs, this code demonstrates effective and efficient handling of potential issues that might arise during application execution.

600
Forms/Data Sheet Select.md Normal file
View File

@ -0,0 +1,600 @@
# Data Sheet Select
Analysis generated on: 4/1/2025 4:05:25 PM
---
## Record Source
- [[Tables/Process]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field1 | PartNumber (from [[Tables/Process]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub AddAProcShet()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Dim MachNamesDB As Database, MachNamesSet As Recordset
Dim MachQDB As Database, MachQSet As Recordset
Dim MainTableDef As TableDef
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set Main2DB = DBEngine.Workspaces(0).Databases(0)
Set MachNamesDB = DBEngine.Workspaces(0).Databases(0)
Set MachQDB = DBEngine.Workspaces(0).Databases(0)
GoSub Open_Mains
Set MachNamesSet = MachNamesDB.OpenRecordset("MachineNames", DB_OPEN_TABLE) ' Create dynaset.
Set MachQSet = MachQDB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
If (Not (IsNull(Field1))) Or (Trim$(NewPartName_Parm$) = "") Then
PartN$ = Field1
If PartN$ <> "" Then
MainSet.AddNew
MainSet.PartNumber = PartN$
MainSet.Update
Refresh
MachNamesSet.MoveFirst
While Not (MachNamesSet.EOF)
A$ = MachNamesSet.MachineName
MachQSet.AddNew
MachQSet.MachineName = A$
MachQSet.Tool = "***"
MachQSet.PartNumber = PartN$
MachQSet.Update
MachNamesSet.MoveNext
Wend
Refresh
If NewPartName_Parm$ <> "NEW" Then
MainSet.Seek "=", NewPartName_Parm$
Main2Set.Seek "=", PartN$
Main2Set.Edit
For i = 0 To MainSet.Fields.Count - 1
Debug.Print "; "; MainSet.Fields(i).name
If MainSet.Fields(i).name <> "PartNo" Then
Main2Set.Fields(i) = MainSet.Fields(i)
End If
Next i
Main2Set.PartNumber = PartN$
Main2Set.Update
GoSub OPEN_Addnl
MainSet.Seek "=", NewPartName_Parm$
Do While Trim$(MainSet.PartNumber) = NewPartName_Parm$
Main2Set.AddNew
For i = 0 To MainSet.Fields.Count - 1
Debug.Print "; "; MainSet.Fields(i).name
If MainSet.Fields(i).name <> "PartNo" Then
Main2Set.Fields(i) = MainSet.Fields(i)
End If
Next i
Main2Set.PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
Loop
GoSub OPEN_Machs
MainSet.Seek "=", NewPartName_Parm$
Main2Set.Seek "=", PartN$
Do While Trim$(MainSet.PartNumber) = NewPartName_Parm$
Main2Set.Edit
For i = 0 To MainSet.Fields.Count - 1
Debug.Print "; "; MainSet.Fields(i).name
If MainSet.Fields(i).name <> "PartNo" Then
Main2Set.Fields(i) = MainSet.Fields(i)
End If
Next i
Main2Set.PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
Main2Set.MoveNext
Loop
GoSub Open_Mains
End If
End If
End If
Field1 = ""
Exit Sub
Open_Mains:
Set MainSet = MainDB.OpenRecordset("Process", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("Process", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PrimaryKey"
Main2Set.Index = "PrimaryKey"
Return
OPEN_Addnl:
Set MainSet = MainDB.OpenRecordset("AddnlProc", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("AddnlProc", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Return
OPEN_Machs:
Set MainSet = MainDB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Return
End Sub
Private Sub Button0_Click()
On Error GoTo Err_Button0_Click
Dim DocName As String
Dim LinkCriteria As String
PN$ = Field1
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
DoCmd.FindRecord PN$
DoCmd.SelectObject A_FORM, "Data Sheet Select"
DoCmd.Close
Exit_Button0_Click:
Exit Sub
Err_Button0_Click:
MsgBox Error$
Resume Exit_Button0_Click
End Sub
Private Sub Button12_Click()
On Error GoTo Err_Button12_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS PressBrake"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PRESSBRAKE')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button12_Click:
Exit Sub
Err_Button12_Click:
MsgBox Error$
Resume Exit_Button12_Click
End Sub
Private Sub Button14_Click()
On Error GoTo Err_Button14_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS MultShear"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'MULTSHEAR')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button14_Click:
Exit Sub
Err_Button14_Click:
MsgBox Error$
Resume Exit_Button14_Click
End Sub
Private Sub Button16_Click()
On Error GoTo Err_Button16_Click
Dim DocName As String
Dim LinkCriteria As String
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q2"
Exit_Button16_Click:
Exit Sub
Err_Button16_Click:
MsgBox Error$
Resume Exit_Button16_Click
End Sub
Private Sub Button2_Click()
On Error GoTo Err_Button2_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Laser"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'LASER')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button2_Click:
Exit Sub
Err_Button2_Click:
MsgBox Error$
Resume Exit_Button2_Click
End Sub
Private Sub Button3_Click()
On Error GoTo Err_Button3_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS CNC"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'CNC')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button3_Click:
Exit Sub
Err_Button3_Click:
MsgBox Error$
Resume Exit_Button3_Click
End Sub
Private Sub Button4_Click()
On Error GoTo Err_Button4_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS PressBrake"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PRESSBRAKE')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button4_Click:
Exit Sub
Err_Button4_Click:
MsgBox Error$
Resume Exit_Button4_Click
End Sub
Private Sub Button5_Click()
On Error GoTo Err_Button5_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Shear"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'SHEAR')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button5_Click:
Exit Sub
Err_Button5_Click:
MsgBox Error$
Resume Exit_Button5_Click
End Sub
Private Sub Button6_Click()
On Error GoTo Err_Button6_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Timesaver"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'TIMESAVER')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button6_Click:
Exit Sub
Err_Button6_Click:
MsgBox Error$
Resume Exit_Button6_Click
End Sub
Private Sub Button7_Click()
On Error GoTo Err_Button7_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Hand Deburr"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'HANDDEBURR')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button7_Click:
Exit Sub
Err_Button7_Click:
MsgBox Error$
Resume Exit_Button7_Click
End Sub
Private Sub Button8_Click()
On Error GoTo Err_Button8_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Pedestal"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PEDESTAL')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button8_Click:
Exit Sub
Err_Button8_Click:
MsgBox Error$
Resume Exit_Button8_Click
End Sub
Private Sub Button9_Click()
On Error GoTo Err_Button9_Click
Dim DocName As String
Dim LinkCriteria As String
Dim MyForm As Form
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q2"
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_REPORT, "Process Sheet Print"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Laser"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'LASER')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Laser"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS CNC"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'CNC')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS CNC"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS PressBrake"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PRESSBRAKE')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS PressBrake"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Shear"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'SHEAR')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Shear"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Timesaver"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'TIMESAVER')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Timesaver"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Hand Deburr"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'HANDDEBURR')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Hand Deburr"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Pedestal"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PEDESTAL')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Pedestal"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS MultShear"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'MULTSHEAR')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS MultShear"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
DocName = "DS Shake and Break"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'SHAKE')"
DoCmd.OpenForm DocName, , , LinkCriteria
On Error GoTo tryNext: formExists = True
DoCmd.SelectObject A_FORM, "DS Shake and Break"
If formExists Then
DoCmd.PrintOut
DoCmd.Close
End If
Exit_Button9_Click:
Exit Sub
Err_Button9_Click:
MsgBox Error$
Resume Exit_Button9_Click
tryNext:
formExists = False
Resume Next
End Sub
Private Sub Command17_Click()
On Error GoTo Err_Button17_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Pem Press Manual"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'PEM')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button17_Click:
Exit Sub
Err_Button17_Click:
MsgBox Error$
Resume Exit_Button17_Click
End Sub
Private Sub Command18_Click()
On Error GoTo Err_Button18_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Shake and Break"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'SHAKEBREAK')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button18_Click:
Exit Sub
Err_Button18_Click:
MsgBox Error$
Resume Exit_Button18_Click
End Sub
Private Sub Command19_Click()
On Error GoTo Err_Button19_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "DS Salvagnini"
LinkCriteria = "([PartNumber] = Forms![Data Sheet Select]![Field1]) and([SheetType] = 'SALVAGNINI')"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button19_Click:
Exit Sub
Err_Button19_Click:
MsgBox Error$
Resume Exit_Button19_Click
End Sub
```
## What it does
**AddAProcSheet VBA Code Description**
=====================================
This VBA code is used to automate the addition of new processes and machines records in a database, while also updating related additional process and machine records.
**Initialization**
-----------------
The code begins by setting up various database connections:
* `MainDB`, `MainSet`, `MachNamesDB`, `MachQDB` are databases and recordsets connected to the main workspace.
* `Main2DB` and `Main2Set` are also connected to the main workspace.
**Subroutine Flow**
------------------
The code then calls the `AddAProcShet` subroutine, which performs the following actions:
1. **Open Main Databases**: The `GoSub Open_Mains` subroutine is called to open the main databases (`MainDB` and `Main2DB`) and set up their recordsets.
2. **Check for Existing Data**: The code checks if the `Field1` value or the `NewPartName_Parm$` parameter is not empty. If either condition is true, it proceeds with the addition of new records.
**Add New Records**
------------------
If the previous step passes, the code adds new records to the following tables:
* **Machine Names**: A new machine name record is added for each existing machine in `MachNamesSet`.
* **Main Processes**: If a part number is not empty, it creates a new main process record and updates the related additional process record.
**Update Additional Process Records**
-------------------------------------
If a part number is provided and it's not "NEW", the code:
* Updates the main process record with the new part number.
* Calls `GoSub OPEN_Addnl` to set up the additional process table connection.
* Performs a full update of all records in the additional process table, ensuring that all fields match those in the main process table.
**Update Machine Records**
-------------------------
After updating the additional process records, the code:
* Calls `GoSub Open_Machs` to open the machines recordset.
* Performs a full update of all records in the machines table using the updated part number from the main process records.
**Cleanup**
------------
Finally, the code resets the `Field1` value and exits the subroutine.
**Notes**
* The use of `GoSub` statements to call subroutines within the same code block is an older VBA feature. Modern VBA coding would typically avoid this practice.
* The code uses `Debug.Print` statements for debugging purposes, which can be removed or replaced with more suitable error handling mechanisms in production environments.
* The use of `DB_OPEN_TABLE` as a database open option may not be the most efficient choice, especially if dealing with large datasets.

1293
Forms/Delete this.md Normal file

File diff suppressed because it is too large Load Diff

58
Forms/ErrorForm.md Normal file
View File

@ -0,0 +1,58 @@
# ErrorForm
Analysis generated on: 4/1/2025 4:09:34 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub CalculationStatus_Enter()
Call ErrorMessages
End Sub
Private Sub Command4_Click()
Call ErrorMessages
End Sub
Private Sub Form_Load()
Set currform = Me
End Sub
```
## What it does
**VBA Code Description**
=========================
### Overview
This VBA code snippet is written in an Excel or Access environment and appears to be part of a user interface. It defines three event handlers that respond to specific actions within the application.
### Event Handlers
#### 1. `CalculationStatus_Enter()`
* **Purpose:** This event handler is triggered when the user enters a cell while focusing on the `CalculationStatus` form.
* **Behavior:** The code calls the `ErrorMessages` subroutine, which is not shown in this snippet. This suggests that there might be some error handling or notification mechanism implemented elsewhere in the application.
#### 2. `Command4_Click()`
* **Purpose:** This event handler responds to a click action on a control with the ID "Command4" ( likely a button).
* **Behavior:** Similar to the previous event handler, it also calls the `ErrorMessages` subroutine. Again, this implies that there's some kind of error handling or notification mechanism implemented elsewhere in the application.
#### 3. `Form_Load()`
* **Purpose:** This event handler is triggered when the form loads.
* **Behavior:** It sets a variable named `currform` to reference the current form (`Me`). This allows for accessing form-level variables and properties within the code.
### Comparison
The code uses the `Option Compare Database` directive at the top, which specifies the string comparison behavior for VBA. However, there is no further explanation of this setting in the context of the provided event handlers.
Overall, these event handlers suggest that the application might be designed to handle errors or notifications in a standardized manner, and they use a consistent approach by calling the `ErrorMessages` subroutine in both cases.

201
Forms/Filtered Parts old.md Normal file
View File

@ -0,0 +1,201 @@
# Filtered Parts old
Analysis generated on: 4/1/2025 4:09:40 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command13_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Setting up Database"
Dim stDocName As String
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Filtered Parts") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
'"Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!PartNumber
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Putting Parts in 'Process By List' Table"
stDocName = "Filtered Parts 4"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Done!!!! You can view Spread Sheet or Process Sheet"
Exit_Command13_Click:
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by List"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command18_Click()
lblstatus.Caption = "Filtering Parts"
stDocName = "Filtered Parts 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Ready for the next button"
End Sub
Private Sub Command20_Click()
DoCmd.OpenTable "Filtered Parts", acViewNormal
lblstatus.Caption = "Don't Forget To Modify any Queries Before Running Parts"
End Sub
Private Sub Command22_Click()
DoCmd.OpenQuery "Filtered Parts 4", acViewDesign
lblstatus.Caption = "Ready to Run Parts Through AS-400"
End Sub
Private Sub Command23_Click()
DoCmd.OpenQuery "Filtered Parts 3", acViewNormal
End Sub
Private Sub Command24_Click()
DoCmd.OpenQuery "Filtered Parts 3", acViewDesign
lblstatus.Caption = "Check the Final Querie for any additional changes"
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is written in Access and appears to be part of an inventory management system. It consists of several subroutines that perform various tasks related to data manipulation, querying, and reporting.
### Command13_Click Subroutine
-----------------------------
This subroutine is triggered when a button with the label "Command 13" is clicked. The code performs the following actions:
1. **Sets up Database**: Sets up two databases (`MainDB` and `MainDB2`) using the currently active workspace.
2. **Purges AS400 product number file**: Deletes all records from the `RMSFILES#_IEMUP1A0` recordset in `MainDB`.
3. **Moves parts to AS400**: Iterates through the records in the `Filtered Parts` recordset in `MainDB2`, adds each record to the corresponding recordset in `MainDB`, and updates the database.
4. **Activates AS400 Program**: Activates an XLCtl24 button, which likely triggers some external program or task.
5. **Puts parts in 'Process By List' Table**: Opens a query named "Filtered Parts 4" in edit mode.
### Command16_Click Subroutine
--------------------------------
This subroutine is triggered when another button with the label "Command 16" is clicked. The code:
1. **Opens Process Sheet form**: Opens a form named "14 Process Sheet" and sets its record source to "Processes by List".
2. **Error handling**: Catches any errors that occur during execution and displays an error message.
### Command18_Click Subroutine
--------------------------------
This subroutine is triggered when yet another button with the label "Command 18" is clicked. The code:
1. **Opens Filtered Parts query**: Opens a query named "Filtered Parts 2" in edit mode.
2. **Updates status label**: Sets the caption of a label (`lblstatus`) to indicate that the process is complete.
### Command20_Click Subroutine
---------------------------------
This subroutine is triggered when a button with the label "Command 20" is clicked. The code:
1. **Opens Filtered Parts table view**: Opens a table named "Filtered Parts" in view mode.
2. **Updates status label**: Sets the caption of a label (`lblstatus`) to indicate that the process is complete.
### Command22_Click Subroutine
---------------------------------
This subroutine is triggered when a button with the label "Command 22" is clicked. The code:
1. **Opens Filtered Parts query in design mode**: Opens a query named "Filtered Parts 4" in design view.
2. **Updates status label**: Sets the caption of a label (`lblstatus`) to indicate that the process is complete.
### Command23_Click Subroutine
---------------------------------
This subroutine is triggered when a button with the label "Command 23" is clicked. The code:
1. **Opens Filtered Parts query in normal view**: Opens a query named "Filtered Parts 3" in normal view.
2. **Does nothing else** (yet)
### Command24_Click Subroutine
---------------------------------
This subroutine is triggered when a button with the label "Command 24" is clicked. The code:
1. **Opens Filtered Parts query in design mode**: Opens a query named "Filtered Parts 3" in design view.
2. **Updates status label**: Sets the caption of a label (`lblstatus`) to indicate that the process is complete.
**Common Elements**
--------------------
Throughout these subroutines, there are several common elements:
* The use of `DoEvents` statements to ensure proper processing and prevent blocking.
* Error handling using `On Error Resume Next` and `On Error GoTo Err_CommandSubroutine`, which catch any errors that occur during execution and display an error message.
**Conclusion**
--------------
This VBA code provides a basic framework for interacting with databases, querying data, and updating records. While it may require modification or extension to meet specific requirements, its structure and functionality provide a solid foundation for further development.

193
Forms/Filtered Parts.md Normal file
View File

@ -0,0 +1,193 @@
# Filtered Parts
Analysis generated on: 4/1/2025 4:09:54 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command13_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Setting up Database"
Dim stDocName As String
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Filtered Parts") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
'"Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!PartNumber
MainSet.AddNew
MainSet!PRDNO = p$
On Error Resume Next
MainSet.Update
On Error GoTo 0
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Putting Parts in 'Process By List' Table"
stDocName = "Filtered Parts 4"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Done!!!! You can view Spread Sheet or Process Sheet"
Exit_Command13_Click:
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by List"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command18_Click()
lblstatus.Caption = "Filtering Parts"
stDocName = "Filtered Parts 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Ready for the next button"
End Sub
Private Sub Command20_Click()
DoCmd.OpenTable "Filtered Parts", acViewNormal
lblstatus.Caption = "Don't Forget To Modify any Queries Before Running Parts"
End Sub
Private Sub Command22_Click()
DoCmd.OpenQuery "Filtered Parts 4", acViewDesign
lblstatus.Caption = "Ready to Run Parts Through AS-400"
End Sub
Private Sub Command23_Click()
DoCmd.OpenQuery "Filtered Parts 3", acViewNormal
End Sub
Private Sub Command24_Click()
DoCmd.OpenQuery "Filtered Parts 3", acViewDesign
lblstatus.Caption = "Check the Final Querie for any additional changes"
End Sub
```
## What it does
**VBA Code Description**
This VBA code is written in Access and appears to be part of an inventory management system. It handles various tasks related to filtering, processing, and activating parts data.
### Command13_Click
* **Purpose:** This subroutine is triggered when a button with ID 13 is clicked.
* **Steps:**
* Opens two databases (`MainDB` and `MainDB2`) and sets up Recordsets for "RMSFILES#_IEMUP1A0" and "Filtered Parts".
* Purgues the AS400 product number file by deleting all records in the first Recordset.
* Moves data from the second Recordset to the first Recordset, mapping PartNumber to PRDNO fields.
* Activates an AS400 program using ActiveX Control 24 and updates a process sheet query.
* Displays a status message indicating completion.
### Command16_Click
* **Purpose:** This subroutine is triggered when another button with ID 16 is clicked.
* **Steps:**
* Opens a form named "14" + Chr$(34) + " Process Sheet" and sets its record source to the "Processes by List" query.
* Exits the subroutine.
### Command18_Click
* **Purpose:** This subroutine is triggered when another button with ID 18 is clicked.
* **Steps:**
* Opens a query named "Filtered Parts 2" in normal view, displaying the filtered parts data.
* Updates the status message to indicate readiness for the next action.
### Command20_Click
* **Purpose:** This subroutine is triggered when another button with ID 20 is clicked.
* **Steps:**
* Opens a table named "Filtered Parts" in normal view, allowing users to modify it before proceeding.
* Updates the status message to remind users to modify queries before running parts.
### Command22_Click
* **Purpose:** This subroutine is triggered when another button with ID 22 is clicked.
* **Steps:**
* Opens a query named "Filtered Parts 4" in normal view, displaying data ready for processing through AS-400.
* Updates the status message to indicate readiness for further actions.
### Command23_Click
* **Purpose:** This subroutine is triggered when another button with ID 23 is clicked.
* **Steps:**
* Opens a query named "Filtered Parts 3" in normal view, displaying data.
### Command24_Click
* **Purpose:** This subroutine is triggered when another button with ID 24 is clicked.
* **Steps:**
* Opens a query named "Filtered Parts 3" in design view, allowing users to modify the query further before running parts through AS-400.
* Updates the status message to indicate readiness for final checks.
**Key Features and Functions**
* Database management and Recordset creation
* Data purging and processing
* Form opening and record source setting
* Query opening in normal and design views
**Error Handling**
The code includes error handling mechanisms, such as `On Error Resume Next` and `On Error GoTo Err_CommandName_Click`, to catch and display error messages.

22
Forms/Form1.md Normal file
View File

@ -0,0 +1,22 @@
# Form1
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Tables/AddnlProc]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Tables/AddnlProc]]) |
| OPCode | OPCode (from [[Tables/AddnlProc]]) |
| Description | Description (from [[Tables/AddnlProc]]) |
| WC1 | WC1 (from [[Tables/AddnlProc]]) |
| WC2 | WC2 (from [[Tables/AddnlProc]]) |
| WC3 | WC3 (from [[Tables/AddnlProc]]) |
| WC4 | WC4 (from [[Tables/AddnlProc]]) |
| Machine | Machine (from [[Tables/AddnlProc]]) |
| CycleTime | CycleTime (from [[Tables/AddnlProc]]) |
| RunStd | RunStd (from [[Tables/AddnlProc]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

14
Forms/Gauge.md Normal file
View File

@ -0,0 +1,14 @@
# Gauge
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/metalQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| MetalName | MetalName (from [[Queries/metalQ1]]) |
| Gauge | Gauge (from [[Queries/metalQ1]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,69 @@
# HoldPartNumberForm
Analysis generated on: 4/1/2025 4:09:19 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
DoCmd.Minimize
End Sub
Private Sub PartNumber_Change()
DoCmd.Minimize
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code snippet is written in Access 2000/XP/Vista and appears to be part of a database application. It contains two event handlers, `Form_Load` and `PartNumber_Change`, which are triggered by specific events.
### Form_Load Event Handler
-----------------------------
```markdown
**Description:** Triggers when the form is loaded.
**Purpose:** Minimizes the current form.
**Code:**
```vb
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Load()
DoCmd.Minimize
End Sub
```
* The `Option Compare Database` line specifies that string comparisons in this code should be performed using a database case-insensitive comparison rule.
* The `Private Sub Form_Load()` statement defines an event handler for the form's load event. When the form is loaded, the code inside this sub-procedure executes.
* Within the event handler, `DoCmd.Minimize` is called to minimize the current form.
### PartNumber_Change Event Handler
----------------------------------
```markdown
**Description:** Triggers when the PartNumber field changes.
**Purpose:** Minimizes the current form.
**Code:**
```vb
Private Sub PartNumber_Change()
DoCmd.Minimize
End Sub
```
* The `Private Sub PartNumber_Change()` statement defines an event handler for the change event of the `PartNumber` field.
* When the value in the `PartNumber` field changes, the code inside this sub-procedure executes.
* Within the event handler, `DoCmd.Minimize` is called to minimize the current form.
### Common Pattern
Both event handlers call `DoCmd.Minimize`, which minimizes the current form. This suggests that minimizing the form might be a common or desired behavior in the application, and this code is used to achieve it when specific events occur.

View File

@ -0,0 +1,272 @@
# Latest Revision of parts
Analysis generated on: 4/1/2025 4:03:20 PM
---
## Record Source
- [[Queries/Processes by material]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command13_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Setting up Database"
Dim stDocName As String
Command16.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
'"Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
stDocName = "Processes by material 2d"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Done"
DoCmd.OpenTable "Process by material 2"
Exit_Command13_Click:
Command16.Enabled = True
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 4"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
Command3.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Call Command4_Click
stDocName = "Processes by material 2a"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenTable "Process by material"
Exit_Command2_Click:
Command3.Enabled = True
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 3"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Private Sub Command4_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
DoCmd.RunMacro "Material Selections for Utilitzation"
Refresh
' "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
' "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
' "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
' lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
' "Retrieving Results"
' DoCmd.RunMacro "AS400 Utiliz Results"
' UtilResult1.SourceObject = "Util Result1"
' ' lblStatus.Caption = "Calculating material utilization on parts"
' lblstatus.Caption = "Done"
' Command133.Caption = Command133.Tag'
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is part of an Access database application, and it appears to be a macro for automating tasks related to data processing and material selection.
### Option Compare Database
The first line sets the option comparison level to "Database", which means that the code will compare strings using a database's collation settings.
**Command13_Click**
-------------------
This is the main subroutine of interest. It performs the following tasks:
1. Opens two databases, `MainDB` and `MainDB2`, from the current workspace.
2. Enables Command16, which allows the user to open a form.
3. Sets up a status label (`lblstatus`) to display messages throughout the process.
4. Moves data from `MainDB` to `MainDB2` using two Recordsets: `RMSFILES#_IEMUP1A0` and `Process by material`.
* It first purges any existing records in `MainDB2`.
* Then, it moves each record from `MainDB` to `MainDB2`, updating the corresponding fields.
5. Activates an AS400 program (not shown in this code snippet) using a control (`ActiveXCtl24`).
6. Opens another query, "Processes by material 2d", and enables Command16 again after completion.
**Command16_Click**
-------------------
This subroutine:
1. Opens a form named "14 Process Sheet" from the current database.
2. Sets the record source of the form to "Processes by material 4".
3. Closes the form when it's finished.
**Command2_Click**
------------------
This subroutine:
1. Opens two queries, "Processes by material 2" and "Processes by material 2a", from the current database.
2. Calls another macro, `Command4_Click`, after opening both queries.
3. Enables Command3 after completion.
**Command3_Click**
-------------------
Similar to `Command16_Click`, this subroutine opens a form named "14 Process Sheet" and sets its record source to "Processes by material 3".
**Command4_Click**
------------------
This macro:
1. Runs another macro, "Material Selections for Utilitzation", using the built-in `DoCmd.RunMacro` method.
2. Refreshes the current database (not shown in this code snippet).
Overall, this VBA code automates tasks related to data processing and material selection, including moving data between databases and activating an AS400 program.

256
Forms/Main Menu.md Normal file
View File

@ -0,0 +1,256 @@
# Main Menu
Analysis generated on: 4/1/2025 4:08:03 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub BeginMakePart_Click()
On Error GoTo Err_BeginMakePart_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "MakeForm"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_BeginMakePart_Click:
Exit Sub
Err_BeginMakePart_Click:
MsgBox Error$
Resume Exit_BeginMakePart_Click
End Sub
Private Sub Button16_Click()
End Sub
Private Sub Button17_Click()
On Error GoTo Err_Button17_Click
Dim DocName As String
Dim LinkCriteria As String
PrimaryScreen$ = "MakeForm"
DocName = "Material Selection Screen"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button17_Click:
Exit Sub
Err_Button17_Click:
MsgBox Error$
Resume Exit_Button17_Click
End Sub
Private Sub Button18_Click()
On Error GoTo Err_Button18_Click
Dim DocName As String
Dim LinkCriteria As String
PrimaryScreen$ = "MakeForm"
DocName = "Universal Selection Screen"
UnivREQName$ = "PhantomNumber"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button18_Click:
Exit Sub
Err_Button18_Click:
MsgBox Error$
Resume Exit_Button18_Click
End Sub
Private Sub Button19_Click()
On Error GoTo Err_Button19_Click
Dim DocName As String
Dim LinkCriteria As String
LinkCriteria = "WareHouse='90'"
Call ckPrimaryScreen
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button19_Click:
Exit Sub
Err_Button19_Click:
MsgBox Error$
Resume Exit_Button19_Click
End Sub
Private Sub Button20_Click()
On Error GoTo Err_Button20_Click
Dim DocName As String
Dim LinkCriteria As String
LinkCriteria = "WareHouse='02'"
Call ckPrimaryScreen
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button20_Click:
Exit Sub
Err_Button20_Click:
MsgBox Error$
Resume Exit_Button20_Click
End Sub
Private Sub Button21_Click()
Button21.Caption = "CALCULATING"
DoEvents
' Single part recalculate
A$ = Trim$(itsaNull$(PartNumber))
If PaperCutFlag Then b$ = "1" Else b$ = "0"
Call LaserTapeGenerate(A$, b$)
Button21.Caption = "Process Laser Tape"
Exit Sub
' Multiple part recalculate
If PaperCutFlag Then b$ = "1" Else b$ = "0"
On Error Resume Next
MkDir "C:\Files\Process\"
On Error GoTo 0
Open "C:\Files\Process\junk.dat" For Input As #15
While Not (EOF(15))
Line Input #15, A$
A$ = Trim$(A$)
Call LaserTapeGenerate(A$, b$)
Wend
Close #15
Button21.Caption = "Process Laser Tape"
End Sub
Private Sub Button6_Click()
On Error GoTo Err_Button6_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Universal Selection Screen"
UnivREQName$ = "PhantomNumber"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button6_Click:
Exit Sub
Err_Button6_Click:
MsgBox Error$
Resume Exit_Button6_Click
End Sub
Private Sub Command24_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub Form_Load()
PaperCutFlag = 0
End Sub
Private Sub Form_Open(Cancel As Integer)
If Exists("\\fryfs001v\eng\DEPTS\IE\PROCESS\ACCESS\PSLine2000.kil") Then
Application.Quit
End If
End Sub
Private Sub Form_Timer()
If Exists("\\fryfs001v\eng\DEPTS\IE\PROCESS\ACCESS\PSLine2000.kil") Then
Application.Quit
End If
End Sub
Private Sub MaterSelect_Click()
On Error GoTo Err_MaterSelect_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Material Selection Screen"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_MaterSelect_Click:
Exit Sub
Err_MaterSelect_Click:
MsgBox Error$
Resume Exit_MaterSelect_Click
End Sub
Private Sub Process_Sheet_Click()
On Error GoTo Err_Process_Sheet_Click
Dim DocName As String
Dim LinkCriteria As String
Call ckPrimaryScreen
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Process_Sheet_Click:
Exit Sub
Err_Process_Sheet_Click:
MsgBox Error$
Resume Exit_Process_Sheet_Click
End Sub
Private Sub Sheet_Utilization_Utilites_Click()
On Error GoTo Err_Sheet_Utilization_Utilites_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sheet Utilization Utilites"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Sheet_Utilization_Utilites_Click:
Exit Sub
Err_Sheet_Utilization_Utilites_Click:
MsgBox Err.Description
Resume Exit_Sheet_Utilization_Utilites_Click
End Sub
```
## What it does
*Failed to generate documentation with Ollama*

181
Forms/MakeForm.md Normal file
View File

@ -0,0 +1,181 @@
# MakeForm
Analysis generated on: 4/1/2025 4:00:41 PM
---
## Record Source
- [[Queries/Qmake1-14]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/Qmake1-14]]) |
| PartName | PartName (from [[Queries/Qmake1-14]]) |
| IssueNumber | IssueNumber (from [[Queries/Qmake1-14]]) |
| IssueDate | IssueDate (from [[Queries/Qmake1-14]]) |
| PreviousIssue | PreviousIssue (from [[Queries/Qmake1-14]]) |
| PreviousDate | PreviousDate (from [[Queries/Qmake1-14]]) |
| History | History (from [[Queries/Qmake1-14]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/Qmake1-14]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/Qmake1-14]]) |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/Qmake1-14]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/Qmake1-14]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/Qmake1-14]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/Qmake1-14]]) |
| BlankSize | BlankSize (from [[Queries/Qmake1-14]]) |
| GrossWt | GrossWt (from [[Queries/Qmake1-14]]) |
| PartSize | PartSize (from [[Queries/Qmake1-14]]) |
| ActualWt | ActualWt (from [[Queries/Qmake1-14]]) |
| Utilization | Utilization (from [[Queries/Qmake1-14]]) |
| SheetSize | SheetSize (from [[Queries/Qmake1-14]]) |
| MaterialCost | MaterialCost (from [[Queries/Qmake1-14]]) |
| LaborCost | LaborCost (from [[Queries/Qmake1-14]]) |
| PartCost | PartCost (from [[Queries/Qmake1-14]]) |
| PhantomNumber | PhantomNumber (from [[Queries/Qmake1-14]]) |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button37_Click()
PN$ = Me!PartNumber
Phn$ = itsaNull$(Me!PhantomNumber)
Call RefreshFromPhantom(PN$, Phn$)
Refresh
End Sub
Private Sub Button38_Click()
Dim HoldForm As Form
PN$ = Me!PartNumber
Phn$ = itsaNull$(Me!PhantomNumber)
If (PN$ <> Phn$) And (Phn$ <> "") Then
Call GOTOPARTNUMBER(Phn$, "MakeForm")
End If
End Sub
Private Sub Button39_Click()
On Error GoTo Err_Button39_Click
Dim DocName As String
Dim LinkCriteria As String
PrimaryScreen$ = "MakeForm"
NewPartName_Parm$ = Me!PartNumber
DocName = "New Process Sheet"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_Button39_Click:
Exit Sub
Err_Button39_Click:
MsgBox Error$
Resume Exit_Button39_Click
End Sub
Private Sub Button40_Click()
Dim DocName As String
Dim MyForm As Form
Refresh
DocName = "Main Menu"
DoCmd.OpenForm DocName, , , LinkCriteria
DoCmd.SelectObject A_FORM, DocName
Forms.[Main Menu].PartNumber = Forms.Makeform.PartNumber
DoCmd.SelectObject A_FORM, "MAKEForm"
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1MainMenu"
End Sub
Private Sub Button41_Click()
PN$ = PartNumber
DocName = "MakeForm"
DoCmd.OpenForm DocName, , , LinkCriteria
DoCmd.GoToControl "PartNumber"
DoCmd.FindRecord PN$, A_ANYWHERE, False, A_DOWN, , , True
DoCmd.DoMenuItem A_FORMBAR, A_EDITMENU, 9
End Sub
Private Sub Button46_Click()
Call renumber
End Sub
Private Sub Form_Activate()
A = ReadInits()
End Sub
Private Sub Form_Current()
Call Views
End Sub
Private Sub Form_Load()
Set currform = Me
End Sub
Private Sub ToggleViews_Click()
Call Views
End Sub
Private Sub Views()
If ToggleViews Then
ToggleViews.Caption = "Viewing Process Text Entry "
Embedded31.Visible = True
Embedded24.Visible = False
Else
ToggleViews.Caption = "Viewing Generated Process Text"
Embedded31.Visible = False
Embedded24.Visible = True
End If
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is written for an Access database application and appears to be part of a larger form-based interface. The code snippet covers several buttons and events, including:
### Button 37: Refresh Form with Part Number and Phantom Number
* When the button is clicked, it retrieves the `PartNumber` and `PhantomNumber` values from the current form.
* It then calls the `RefreshFromPhantom` subroutine to refresh the form based on these values.
### Button 38: Open "MakeForm" Form with Different Part Number
* When the button is clicked, it checks if the `PartNumber` and `PhantomNumber` values are different from each other.
* If they are, it calls the `GOTOPARTNUMBER` subroutine to open a new form named "MakeForm" with the updated `PhantomNumber`.
### Button 39: Open "New Process Sheet" Form
* When the button is clicked, it attempts to open a new form named "New Process Sheet".
* If an error occurs, it displays an error message and continues executing.
### Button 40: Switch Between Main Menu and Process Sheet Print Forms
* When the button is clicked, it refreshes the current form and then opens two forms: "Main Menu" and "Process Sheet Print".
* It also updates the part number on both forms.
### Button 41: Search for Part Number in Current Form
* When the button is clicked, it searches for a record with the specified `PartNumber` value.
* If found, it navigates to that control in the current form.
### Button 46: Call "renumber" Subroutine
* When the button is clicked, it calls the `renumber` subroutine.
### Form Activate Event
* When the form becomes active, it reads in initialization data using the `ReadInits` function and stores the result in a variable named `A`.
### Form Current Event
* When the current record changes, it calls the `Views` subroutine to update the form accordingly.
### Form Load Event
* When the form loads, it sets up an object reference to itself and assigns it to a local variable named `currform`.
### Toggle Views Button Clicked Event
* When the button is clicked, it toggles the visibility of two controls (Embedded31 and Embedded24) based on the current state of the "Viewing Process Text Entry" caption.
Overall, this code snippet appears to be part of a larger form-based interface for managing process sheets and associated data. It provides functionality for refreshing forms, opening new forms, searching for records, and toggling views between different modes.

View File

@ -0,0 +1,196 @@
# Material Selection Screen
Analysis generated on: 4/1/2025 4:04:59 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| Material (Row Source) | [[Tables/[metalQ1];]] |
| CutTypes (Row Source) | |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button2_Click()
Call ckPrimaryScreen
ErrM.Caption = ""
A = SelectBy
b = SelWarehouse
Select Case b
Case 1
Sw$ = ""
sw2$ = ""
Case 2
Sw$ = " and Warehouse='90'"
sw2$ = "Warehouse='90'"
Case 3
Sw$ = " and Warehouse='02'"
sw2$ = "Warehouse='02'"
Case Else
End Select
Select Case A
Case 1
Mater$ = itsaNull$(Material)
If Mater$ <> "" Then
DoCmd.OpenForm PrimaryScreen$, , , "MetalType='" + Mater$ + "'" + Sw$
Else
ErrM.Caption = "Invalid Material Selected"
End If
Case 2
Mater$ = itsaNull$(Programmer)
If Mater$ <> "" Then
DoCmd.OpenForm PrimaryScreen$, , , "Programmer='" + Mater$ + "'" + Sw$
Else
ErrM.Caption = "Invalid Programmer Selected"
End If
Case 3
Mater$ = itsaNull$(CutTypes)
If Mater$ <> "" Then
DoCmd.OpenForm PrimaryScreen$, , , "CutType='" + Mater$ + "'" + Sw$
Else
ErrM.Caption = "Invalid Cut Type Selected"
End If
Case 4
DoCmd.OpenForm PrimaryScreen$, , , sw2$
Case Else
End Select
End Sub
Private Sub Button6_Click()
ErrM.Caption = ""
A = SelectBy
Select Case A
Case 1
Mater$ = itsaNull$(Material)
If Mater$ <> "" Then
DoCmd.OpenReport "RSelectMaterial", A_PREVIEW, , "MetalType=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Material Selected"
End If
Case 2
Mater$ = itsaNull$(Programmer)
If Mater$ <> "" Then
DoCmd.OpenReport "RSelectMaterial", A_PREVIEW, , "Programmer=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Programmer Selected"
End If
Case 3
Mater$ = itsaNull$(CutTypes)
If Mater$ <> "" Then
DoCmd.OpenReport "RSelectMaterial", A_PREVIEW, , "Cuttype=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Cut Type Selected"
End If
Case 4
DoCmd.OpenReport "RSelectMaterial", A_PREVIEW
Case Else
End Select
End Sub
Private Sub Button9_Click()
ErrM.Caption = ""
A = SelectBy
Select Case A
Case 1
Mater$ = itsaNull$(Material)
If Mater$ <> "" Then
Call ckPrimaryScreen
DoCmd.OpenForm PrimaryScreen$, A_FORMDS, , "MetalType=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Material Selected"
End If
Case 2
Mater$ = itsaNull$(Programmer)
If Mater$ <> "" Then
Call ckPrimaryScreen
DoCmd.OpenForm PrimaryScreen$, A_FORMDS, , "Programmer=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Programmer Selected"
End If
Case 3
Mater$ = itsaNull$(CutTypes)
If Mater$ <> "" Then
Call ckPrimaryScreen
DoCmd.OpenForm PrimaryScreen$, A_FORMDS, , "Cuttype=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Cut Type Selected"
End If
Case 4
Call ckPrimaryScreen
DoCmd.OpenForm PrimaryScreen$, A_FORMDS
Case Else
End Select
End Sub
Private Sub Command51_Click()
Dim ProcDB As Database, ProcSet As Recordset
Set ProcDB = DBEngine.Workspaces(0).Databases(0)
Set ProcSet = ProcDB.OpenRecordset("Universal", DB_OPEN_DYNASET) ' Create dynaset.
End Sub
Private Sub CutTypes_GotFocus()
SelectBy = 3
End Sub
Private Sub Form_Load()
SelectBy = 1
End Sub
Private Sub Material_GotFocus()
SelectBy = 1
End Sub
Private Sub Programmer_GotFocus()
SelectBy = 2
End Sub
```
## What it does
**Form Toggles and Report Openers**
=====================================
### Overview
This VBA code is used to toggle between different forms in an Access application, as well as open reports. The form toggles are controlled by buttons with unique IDs (Button2, Button6, Button9), while the report opener is controlled by a command button (Command51).
### Form Toggles
The following subroutines control the form toggles:
* `Button2_Click()`: Opens a form (`PrimaryScreen`) based on the selected materials (Material or Programmer). The material type and warehouse are used to filter the results.
* If no material is selected, an error message is displayed.
* Otherwise, the form is opened with the specified parameters.
* `Button6_Click()`: Opens a report (`RSelectMaterial`) based on the selected materials (Material or Programmer).
* The report is opened in preview mode and filtered by the selected material type.
* If no material is selected, an error message is displayed.
* `Button9_Click()`: Opens a form (`PrimaryScreen`) based on the selected materials (Material or Programmer). This subroutine is similar to Button2_Click but uses a different parameter set.
### Report Opener
The following subroutine opens a report:
* `Command51_Click()`: Opens a report (`RSelectMaterial`) in preview mode. The report is filtered by the universal dataset.
### Focus Events
The following focus events are used to change the form toggle settings:
* `CutTypes_GotFocus()`: Sets the form toggle to 3 when the CutTypes control gains focus.
* `Form_Load()` and `Material_GotFocus()`: Set the initial form toggle to 1 (for PrimaryScreen) when the application loads or the Material control gains focus.
### Database Comparison
The following line sets the database comparison order for string comparisons:
```vb
Option Compare Database 'Use database order for string comparisons
```
This option ensures that string comparisons are performed in a case-sensitive manner, as specified by the `Database` comparison type.

View File

@ -0,0 +1,309 @@
# Material Upgrade old
Analysis generated on: 4/1/2025 4:09:00 PM
---
## Record Source
- [[Queries/Processes by material]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command13_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Setting up Database"
Dim stDocName As String
Command16.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
'"Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
stDocName = "Processes by material 2d"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Done"
DoCmd.OpenTable "Process by material 2"
Exit_Command13_Click:
Command16.Enabled = True
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 4"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
Command3.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Call Command4_Click
stDocName = "Processes by material 2a"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenTable "Process by material"
Exit_Command2_Click:
Command3.Enabled = True
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 3"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Private Sub Command4_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
DoCmd.RunMacro "Material Selections for Utilitzation"
Refresh
' "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
' "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
' "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
' lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
' "Retrieving Results"
' DoCmd.RunMacro "AS400 Utiliz Results"
' UtilResult1.SourceObject = "Util Result1"
' ' lblStatus.Caption = "Calculating material utilization on parts"
' lblstatus.Caption = "Done"
' Command133.Caption = Command133.Tag'
End Sub
```
## What it does
**Command13_Click: Database Processing and AS400 Integration**
### Overview
The `Command13_Click` subroutine is responsible for performing a series of database operations and integrating with an external system, specifically the AS400. This process involves:
1. Opening specific queries and tables
2. Moving parts from one database to another (RMSFILES#_IEMUP1A0)
3. Purging product number files from AS400
4. Activating AS400 programs
5. Refreshing the application
### Step-by-Step Breakdown
#### Initialization
* The subroutine sets up two databases (`MainDB` and `MainDB2`) as well as their respective recordsets (`MainSet` and `MainSet2`).
* It also enables/disables certain buttons based on the current state of the application.
#### Moving Parts to AS400
1. **Open RMSFILES#_IEMUP1A0 Query**: The subroutine opens a specific query called "Processes by material 2" using `DoCmd.OpenQuery`. This query is used to retrieve data from one database.
2. **Open Process by material Query**: Another query, "Process by material", is opened in the second database using `DoCmd.OpenTable`.
3. **Move Records and Purge AS400 Product Number File**:
* The subroutine loops through each record in the first query (`MainSet`), deletes it from its original location, and adds a new record to the corresponding table in the second database (`MainSet2`). This process effectively moves data from one database to another while purging product number files from AS400.
4. **Activate AS400 Programs**: The subroutine simulates activating an external program called `ActiveXCtl24` by clicking on it using `DoEvents`.
#### Refresh and Cleanup
* After completing the above steps, the application refreshes itself using `Refresh`.
* The subroutine then closes any open forms or queries.
### Error Handling
Throughout the code, error handling is implemented using `On Error Resume Next` and `Err_CommandX_Click` handlers. These ensure that if an error occurs during execution, a message box will be displayed with the error description, and the application can continue running by resuming the normal error-handling flow.
**Command16_Click: Material Upgrade Form**
### Overview
The `Command16_Click` subroutine opens a specific form (`"14" + Chr$(34) + " Process Sheet"`), sets its record source to a query called `"Processes by material 4"`, and closes it using `DoCmd.Close`.
### Step-by-Step Breakdown
1. **Open Material Upgrade Form**: The subroutine opens the specified form.
2. **Set Record Source**: It sets the record source of the form to a specific query, `"Processes by material 4"`.
3. **Close Form**: Finally, it closes the form using `DoCmd.Close`.
**Command2_Click: Process Material Upgrade**
### Overview
The `Command2_Click` subroutine opens two specific queries (`"Processes by material 2"` and `"Processes by material 2a"`), calls another subroutine (`Command4_Click`) to perform some actions, and then closes the first query.
### Step-by-Step Breakdown
1. **Open Queries**: The subroutine opens both specified queries.
2. **Call Command4_Click**: It calls another subroutine (`Command4_Click`) to perform specific actions.
3. **Close First Query**: Finally, it closes the first opened query using `DoCmd.Close`.
**Command3_Click: Material Selections for Utilitzation Macro**
### Overview
The `Command3_Click` subroutine opens a form called `"14" + Chr$(34) + " Process Sheet"` and sets its record source to a specific query called `"Processes by material 3"`. It then closes the form using `DoCmd.Close`.
### Step-by-Step Breakdown
1. **Open Material Selections Form**: The subroutine opens the specified form.
2. **Set Record Source**: It sets the record source of the form to a specific query, `"Processes by material 3"`.
3. **Close Form**: Finally, it closes the form using `DoCmd.Close`.
**Command4_Click: Material Selections for Utilitzation Macro**
### Overview
The `Command4_Click` subroutine performs several database operations and integrates with an external system.
### Step-by-Step Breakdown
1. **Material Selections Macro**: The subroutine runs a specific macro called `"Material Selections for Utilitzation"`.
2. **Refresh Application**: It then refreshes the application using `Refresh`.
This process is likely used to integrate various databases and perform operations that require external system integration, such as data transfer and synchronization.
**Best Practices**
1. Error Handling: Implementing error handling mechanisms ensures that errors are caught and handled properly.
2. Code Organization: Organizing code into clear sections or procedures makes it easier to understand and maintain.
3. Comments and Documentation: Adding comments and documentation can improve the readability of the code, especially for complex processes.
Note: This summary aims to provide a high-level overview of the `Command13_Click` subroutine and its related subroutines, focusing on the main steps involved in database processing and AS400 integration. The actual implementation may vary based on the specific requirements of the application.

384
Forms/Material Upgrade.md Normal file
View File

@ -0,0 +1,384 @@
# Material Upgrade
Analysis generated on: 4/1/2025 4:07:02 PM
---
## Record Source
- [[Queries/Processes by material]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command13_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Setting up Database"
Dim stDocName As String
Command16.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
'"Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
stDocName = "Processes by material 2d"
DoCmd.OpenQuery stDocName, acNormal, acEdit
lblstatus.Caption = "Done"
DoCmd.OpenTable "Process by material 2"
Exit_Command13_Click:
Command16.Enabled = True
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 4"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
Command3.Enabled = False
stDocName = "Processes by material 2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Call Command4_Click
stDocName = "Processes by material 2a"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenTable "Process by material"
Exit_Command2_Click:
Command3.Enabled = True
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by material 3"
DoCmd.Close acForm, "Material Upgrade"
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Private Sub Command4_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
DoCmd.RunMacro "Material Selections for Utilitzation"
Refresh
' "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset.
' "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
' "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
' lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
' "Retrieving Results"
' DoCmd.RunMacro "AS400 Utiliz Results"
' UtilResult1.SourceObject = "Util Result1"
' ' lblStatus.Caption = "Calculating material utilization on parts"
' lblstatus.Caption = "Done"
' Command133.Caption = Command133.Tag'
End Sub
```
## What it does
**VBA Code Overview**
=====================
This VBA code is designed to automate various tasks in Microsoft Access, specifically related to data manipulation and synchronization with an AS400 system. The code consists of four main subroutines: `Command13_Click`, `Command16_Click`, `Command2_Click`, and `Command3_Click`.
**`Command13_Click` Subroutine**
-------------------------------
### Purpose
This subroutine is triggered when a button labeled "Command 13" is clicked. Its primary function is to perform the following tasks:
1. **Open Queries**: Open two queries: "Processes by material 2" and "14 Process Sheet".
2. **Delete Data from RMSFILES#\_IEMUP1A0 Recordset**:
* Move to the first record in the "RMSFILES#\_IEMUP1A0" recordset.
* Delete each record in the recordset until it is empty.
3. **Add Product Numbers to Process by material Recordset**:
* Open the "Process by material" recordset and move to its first record.
* Iterate through each record, adding a product number from the RMSFILES#\_IEMUP1A0 recordset if it exists.
4. **Activate AS400 Program**: Activate an AS400 program.
### Code Structure
```markdown
Option Compare Database
' Initialize databases and recordsets
Dim MainDB As Database
Dim MainSet As Recordset
Dim MainDB2 As Database
Dim MainSet2 As Recordset
' Open queries
DoCmd.OpenQuery "Processes by material 2", acNormal, acEdit
DoCmd.OpenForm "14 Process Sheet"
Forms![14" Process Sheet"].recordSource = "Processes by material 4"
' Delete data from RMSFILES#\_IEMUP1A0 recordset
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset
MainSet.MoveFirst
Do While Not MainSet.EOF
MainSet.Delete
DoEvents
MainSet.MoveNext
Loop
' Add product numbers to Process by material recordset
Set MainSet2 = MainDB2.OpenRecordset("Process by material") ' Create dynaset
MainSet2.MoveFirst
Do While Not MainSet2.EOF
p$ = MainSet2!prt
If Not IsNull(p$) Then
MainSet2.AddNew
MainSet2!PRDNO = p$
MainSet2.Update
DoEvents
End If
MainSet2.MoveNext
Loop
' Activate AS400 program
ActiveXCtl24.DoClick
' Open additional query
DoCmd.OpenQuery "Processes by material 2d"
DoCmd.OpenTable "Process by material 2"
Exit_Command13_Click:
Command16.Enabled = True
Exit Sub
Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click
```
**`Command16_Click` Subroutine**
------------------------------
### Purpose
This subroutine is triggered when a button labeled "Command 16" is clicked. Its primary function is to:
1. **Open Form**: Open the "14 Process Sheet" form.
2. **Refresh Form Data**: Refresh the record source of the "Process Sheet" form to "Processes by material 4".
3. **Close Form**: Close the "Material Upgrade" form.
### Code Structure
```markdown
Private Sub Command16_Click()
' Open form and refresh data
DoCmd.OpenForm "14 Process Sheet"
Forms![14" Process Sheet"].recordSource = "Processes by material 4"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
```
**`Command2_Click` Subroutine**
-----------------------------
### Purpose
This subroutine is triggered when a button labeled "Command 2" is clicked. Its primary function is to:
1. **Open Queries**: Open two queries: "Processes by material 2" and "Processes by material 2a".
2. **Call Command4_Click Subroutine**: Call the `Command4_Click` subroutine.
3. **Close Table**: Close the "Process by material" table.
### Code Structure
```markdown
Private Sub Command2_Click()
' Open queries
DoCmd.OpenQuery "Processes by material 2"
DoCmd.OpenQuery "Processes by material 2a"
Exit_Command2_Click:
Command3.Enabled = True
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
```
**`Command3_Click` Subroutine**
-----------------------------
### Purpose
This subroutine is triggered when a button labeled "Command 3" is clicked. Its primary function is to:
1. **Open Form**: Open the "14 Process Sheet" form.
2. **Refresh Form Data**: Refresh the record source of the "Process Sheet" form to "Processes by material".
### Code Structure
```markdown
Private Sub Command3_Click()
' Open form and refresh data
DoCmd.OpenForm "14 Process Sheet"
Forms![14" Process Sheet"].recordSource = "Processes by material"
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
```
**Note**: The provided code snippets are simplified versions of the original code. It is recommended to review and modify them according to your specific requirements and security standards.

136
Forms/Miscellaneous.md Normal file
View File

@ -0,0 +1,136 @@
# Miscellaneous
Analysis generated on: 4/1/2025 4:02:40 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Option Explicit
Private Sub cmdOpen14two_Click()
On Error GoTo Err_cmdOpen14two_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14 two"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpen14two_Click:
Exit Sub
Err_cmdOpen14two_Click:
MsgBox Err.Description
Resume Exit_cmdOpen14two_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14" + Chr$(34) + " Process Sheet"
DoCmd.OpenForm stDocName
Forms![14" Process Sheet].recordSource = "Processes by List"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Utilization_Form_Click()
On Error GoTo Err_Utilization_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Utilization on Multiple Sheets"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Utilization_Form_Click:
Exit Sub
Err_Utilization_Form_Click:
MsgBox Err.Description
Resume Exit_Utilization_Form_Click
End Sub
Private Sub Gross_Weight_Click()
On Error GoTo Err_Gross_Weight_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sheet Metal Weight"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Gross_Weight_Click:
Exit Sub
Err_Gross_Weight_Click:
MsgBox Err.Description
Resume Exit_Gross_Weight_Click
End Sub
```
## What it does
**Code Description**
======================
The provided VBA code is a set of event-driven procedures written in Microsoft Access's Visual Basic for Applications (VBA) language. These procedures are designed to handle the click events of specific commands in an Access database.
### Common Patterns and Structure
All the procedures follow a similar pattern:
1. Define error handling blocks using `On Error GoTo Err_[ProcedureName]` statements.
2. Declare variables for document names (`stDocName`) and link criteria (`stLinkCriteria`).
3. Set the values for these variables based on the procedure's purpose.
4. Use `DoCmd.OpenForm` to open a specific form in the database, passing the declared variables as arguments.
5. Handle successful execution with an `Exit_ProcedureName:` label, which exits the procedure cleanly.
6. Catch and display any errors that occur using an `Err_[ProcedureName]_Click:` block, then resumes execution from the corresponding error-handling label.
### Procedure Descriptions
#### cmdOpen14two_Click()
This procedure is triggered when a command button labeled "cmdOpen14two" is clicked.
* Opens a specific form named "14 two".
* The form opening process uses `DoCmd.OpenForm` with no specified link criteria.
#### Command16_Click()
When the command button labeled "Command 16" is clicked, this procedure executes:
* Opens a form named "14" + Chr(34) + " Process Sheet".
* Sets the record source of an active form to "Processes by List".
#### Utilization_Form_Click()
This event handler opens a specific form called "Utilization on Multiple Sheets":
* Uses `DoCmd.OpenForm` without any link criteria.
#### Gross_Weight_Click()
When the command button labeled "Gross Weight" is clicked, this procedure executes:
* Opens a form named "Sheet Metal Weight".
### Key Takeaways
* Each procedure handles a specific click event on a command button.
* The procedures share a common pattern for error handling and form opening.
* The code provides basic functionality for managing forms in an Access database.

273
Forms/New Process Sheet.md Normal file
View File

@ -0,0 +1,273 @@
# New Process Sheet
Analysis generated on: 4/1/2025 4:04:01 PM
---
## Record Source
- [[Tables/Process]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim PartN$
Private Sub AddAProcShet()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Dim Main3DB As Database, Main3Set As Recordset
Dim MachNamesDB As Database, MachNamesSet As Recordset
Dim MachQDB As Database, MachQSet As Recordset
Dim MainTableDef As TableDef
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set Main2DB = DBEngine.Workspaces(0).Databases(0)
Set MachNamesDB = DBEngine.Workspaces(0).Databases(0)
Set MachQDB = DBEngine.Workspaces(0).Databases(0)
ErrMessage.Caption = " "
GoSub Open_Mains
Set MachNamesSet = MachNamesDB.OpenRecordset("MachineNames", DB_OPEN_TABLE) ' Create dynaset.
Set MachQSet = MachQDB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
If (Not (IsNull(Field1))) Or (Trim$(NewPartName_Parm$) = "") Then
PartN$ = Field1
If PartN$ <> "" Then
MainSet.AddNew
'MainSet!PartNumber = Left$(PartN$, 9)
'MainSet!PhantomNumber = Left$(PartN$, 9)
MainSet!PartNumber = Left$(PartN$, 11)
MainSet!PhantomNumber = Left$(PartN$, 11)
MainSet!IssueNumber = " "
MainSet!Deburr = "Within"
MainSet!PrintSize = "B"
MainSet!GrainNone = True
' mainset.IssueDate = " "
MainSet!CellDeburrTypes = "Auto"
MainSet!Warehouse = "90"
MainSet!PressBrake = 1
MainSet!CalculationStatus = 1
ef = 0
On Error GoTo DUPLICATE_rec
MainSet.Update
On Error GoTo 0
If ef = 1 Then
Exit Sub
End If
Refresh
If NewPartName_Parm$ <> "NEW" Then
MainSet.Seek "=", NewPartName_Parm$
Main2Set.Seek "=", PartN$
Main2Set.Edit
For i = 0 To MainSet.Fields.Count - 1
Debug.Print "; "; MainSet.Fields(i).name
If MainSet.Fields(i).name <> "PartNumber" Then
Main2Set.Fields(i) = MainSet.Fields(i)
End If
Next i
Main2Set!PartNumber = PartN$
'Main2Set!PhantomNumber = Left$(PartN$, 9)
Main2Set!PhantomNumber = Left$(PartN$, 11)
Main2Set!CalculationStatus = 1
Main2Set.Update
GoSub OPEN_Addnl
MainSet.MoveFirst
MainSet.Seek ">=", NewPartName_Parm$
If Not (MainSet.NoMatch) Then
Do While Trim$(MainSet!PartNumber) = NewPartName_Parm$
Main2Set.AddNew
For i = 0 To MainSet.Fields.Count - 1
Main2Set.Fields(i) = MainSet.Fields(i)
Next i
Debug.Print Main2Set!PartNumber
Debug.Print Main2Set!OpCode
Main2Set!PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
If MainSet.EOF Then Exit Do
Loop
End If
GoSub OPEN_Machs
MainSet.MoveFirst
MainSet.Seek ">=", NewPartName_Parm$
If Not (MainSet.NoMatch) Then
Do While Trim$(MainSet!PartNumber) = NewPartName_Parm$
Main2Set.AddNew
For i = 0 To MainSet.Fields.Count - 1
Main2Set.Fields(i) = MainSet.Fields(i)
Next i
Main2Set!PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
If MainSet.EOF Then Exit Do
Loop
End If
GoSub OPEN_Press
MainSet.MoveFirst
MainSet.Seek ">=", NewPartName_Parm$
If Not (MainSet.NoMatch) Then
Do While Trim$(MainSet!PartNumber) = NewPartName_Parm$
Main2Set.AddNew
For i = 0 To MainSet.Fields.Count - 1
Main2Set.Fields(i) = MainSet.Fields(i)
Next i
Main2Set!PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
If MainSet.EOF Then Exit Do
Loop
End If
GoSub OPEN_Pem
MainSet.MoveFirst
MainSet.Seek ">=", NewPartName_Parm$
If Not (MainSet.NoMatch) Then
Do While Trim$(MainSet!PartNumber) = NewPartName_Parm$
Main2Set.AddNew
For i = 0 To MainSet.Fields.Count - 1
Main2Set.Fields(i) = MainSet.Fields(i)
Next i
Main2Set!PartNumber = PartN$
Main2Set.Update
MainSet.MoveNext
If MainSet.EOF Then Exit Do
Loop
End If
GoSub Open_Mains
End If
End If
End If
Field1 = ""
ErrMessage.Caption = "Part " + PartN$ + " added"
Exit Sub
Open_Mains:
Set MainSet = MainDB.OpenRecordset("Process", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("Process", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PrimaryKey"
Main2Set.Index = "PrimaryKey"
Return
OPEN_Addnl:
Set MainSet = MainDB.OpenRecordset("AddnlProc", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("AddnlProc", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Return
OPEN_Machs:
Set MainSet = MainDB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("Machines", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Refresh
Return
OPEN_Press:
Set MainSet = MainDB.OpenRecordset("PressBrakeOPs", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("PressBrakeOPs", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Refresh
Return
OPEN_Pem:
Set MainSet = MainDB.OpenRecordset("PemPress Ops", DB_OPEN_TABLE) ' Create dynaset.
Set Main2Set = Main2DB.OpenRecordset("PemPress Ops", DB_OPEN_TABLE) ' Create dynaset.
MainSet.Index = "PartNumber"
Main2Set.Index = "PartNumber"
Refresh
Return
DUPLICATE_rec:
ErrMessage.Caption = Error$ + " Part - " + PartN$
ef = 1
Resume Next
End Sub
Private Sub Button0_Click()
On Error GoTo Err_Button0_Click
Dim DocName As String
Dim LinkCriteria As String
PN$ = NewPartName_Parm$
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
DoCmd.FindRecord PN$
DoCmd.SelectObject A_FORM, "New Process Sheet"
DoCmd.Close
Exit_Button0_Click:
Exit Sub
Err_Button0_Click:
MsgBox Error$
Resume Exit_Button0_Click
End Sub
Private Sub Button3_Click()
Call AddAProcShet
NewPartName_Parm$ = PartN$
Call Button0_Click
Call LogFile(PartN$, "Add Process")
End Sub
```
## What it does
Add AProc Sheet Subroutine
==========================
### Description
This VBA subroutine, `AddAProcShet`, is responsible for adding new records to three different tables (`Mains`, `MachineNames`, and `Machines`) in a database. It also updates the `PartNumber` field of an existing record in the `Mains` table.
### Parameters
* `NewPartName_Parm$`: A string parameter that contains the part number of the machine being added or updated.
### Flow
1. The subroutine initializes several databases (`MainDB`, `Main2DB`, `MachNamesDB`, and `MachQDB`) and recordsets (`MainSet` and `MachSets`).
2. If a new part name is provided, it creates two dynamic recordsets: one for the `MachineNames` table and one for the `Machines` table.
3. It checks if a new part number or an empty string is provided. If so, it extracts the part number from the input string.
4. If the part number is not empty, it creates a new record in the `Mains` table with default values for certain fields (e.g., `PartNumber`, `PhantomNumber`, and `CalculationStatus`). It then updates the existing record with the same part number if found.
5. The subroutine checks for duplicates based on the `PartNumber` field and performs additional actions if a duplicate is found:
* If no duplicates are found, it adds new records to both the `Machines` table (`Main2Set`) and the `MachineNames` table (`MachQSet`).
* If a duplicate is found, it updates existing records in both tables with the same part number.
6. After adding or updating records, the subroutine calls three subroutines: `OPEN_Addnl`, `OPEN_Machs`, and `OPEN_Press`, which are not shown in this code snippet.
### Notes
* The `Option Compare Database` line specifies that string comparisons should be performed using the database order (i.e., case-sensitive).
* The `ErrMessage.Caption` line is used to clear an error message, indicating that no errors have occurred so far.
* The `GoSub` statement is used to jump to a specified subroutine (`Open_Mains`) at some point in the code.
### Code Quality
The code is generally well-organized and follows standard VBA coding conventions. However, there are some areas for improvement:
* Comments: While there are some comments scattered throughout the code, they could be more comprehensive and provide clearer explanations of what each section does.
* Variable naming: Some variable names (e.g., `MainDB`, `MachNamesSet`) could be more descriptive or follow a consistent naming convention.
* Error handling: The code uses a simple error handling mechanism (`On Error GoTo DUPLICATE_rec`), but it would be better to handle specific errors and exceptions in a more explicit way.

671
Forms/PROCESS97.md Normal file
View File

@ -0,0 +1,671 @@
# PROCESS97
Analysis generated on: 4/1/2025 4:08:09 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | [[Tables/[PressBrakes];]] |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
On Error GoTo button288_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
Call diskout
End Sub
Private Sub Button324_Click()
'add a data sheet for Eugene!!!
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PressBrake_Click()
Call PBFormView
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
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
**VBA Code Description**
This VBA code is written for a Microsoft Access database application. It appears to be part of an inventory management system, specifically designed for managing parts and processes.
### Button Click Event Handlers
The following buttons have associated click event handlers:
#### `addPr_Click` and `Button193_Click`
These two buttons call the same procedure, `AddPartButton`, which is not shown in this code snippet. It likely adds a new part to the database.
#### `Button184_Click`
This button calls the `Add_Additional_Process` procedure, which is also not shown here. It probably handles additional processing related to parts or reports.
#### `Button190_Click`
This button quits the application when clicked. If an error occurs, it displays an error message and resumes execution.
#### `Button194_Click`
This button prints a report. If an error occurs, it displays an error message and resumes execution.
#### `Button196_Click`
This button refreshes the data and opens a report named "Process Sheet Print". If an error occurs during printing, it displays an error message and resumes execution.
#### `Button200_Click`
This button searches for machines in the database that match the selected part number. It iterates through machine names and updates the database accordingly.
#### `Button224_Click`
This button opens a form to select data sheet records based on the part number. If an error occurs, it displays an error message and resumes execution.
#### `Button246_Click` and `Button247_Click`
These two buttons call the `HistoryR` and `Delete_Part` procedures, respectively. The former likely generates a report or display related to historical data, while the latter deletes parts based on user input.
#### `Button248_Click` and `Button249_Click`
These two buttons call the `Edit_The_Shear_Files` and `Find_By_PartNumber` procedures, which are not shown here. They probably handle editing and searching for parts by part number.
### Global Variables
Several global variables are declared:
* `dwncntL%`, `dwncntT%`, `dwncnt%`, `ToyClick%`, `ToyCaption%`, and `Toys$(10)` are likely counters or arrays used to store data.
* `NewPartName_Parm$` is a string variable used to store the new part name.
* `M$` is a string variable used to store an error message.
### Procedures
The following procedures are referenced but not shown:
* `AddPartButton`
* `Add_Additional_Process`
* `search`
* `HistoryR`
* `Delete_Part`
* `Edit_The_Shear_Files`
* `Find_By_PartNumber`
These procedures likely contain the actual logic for managing parts, processes, and reports.

74
Forms/Parts Per Sheet.md Normal file
View File

@ -0,0 +1,74 @@
# Parts Per Sheet
Analysis generated on: 4/1/2025 4:05:46 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| Cut Type (Row Source) | |
## VBA Code
```vba
Option Compare Database
Private Sub Cut_Type_Click()
A$ = Me![Cut Type]
If A$ = "Multiple" Then
Parting_Tool.Value = 0.2
Trim_Cut_Bottom.Value = 2.25
Me![Parting Tool].Visible = True
Me![Trim Cut Top].Visible = True
Me![Trim Cut Bottom].Visible = True
Else
Parting_Tool.Value = 0
Trim_Cut_Bottom.Value = 0
Me![Parting Tool].Visible = False
Me![Trim Cut Top].Visible = False
Me![Trim Cut Bottom].Visible = False
End If
End Sub
```
## What it does
**Cut Type Click Event Handler**
=====================================
### Overview
This VBA code is a click event handler for a button control named "Cut Type". When the button is clicked, it updates various properties and visibility settings of other controls in the worksheet.
### Code Breakdown
#### Option Comparison
The first line `Option Compare Database` sets the comparison type to Database. This is used to ensure consistent string comparisons across all instances of the code.
#### Sub Procedure
The `Private Sub Cut_Type_Click()` subroutine is defined to handle the click event of the "Cut Type" button.
#### Variable Declaration and Initialization
* `A$`: A string variable that stores the value of the selected cut type. It is assigned the value of the "Cut Type" control using `Me![Cut Type]`.
* `Parting_Tool` and `Trim_Cut_Bottom`: Object variables that reference two other controls in the worksheet.
#### Conditional Logic
The code uses an if-else statement to determine the action to take based on the selected cut type:
**Multiple Cut Type**
* Set `Parting_Tool.Value` to 0.2.
* Set `Trim_Cut_Bottom.Value` to 2.25.
* Show the "Parting Tool" control by setting its visibility to True using `Me![Parting Tool].Visible = True`.
* Show the "Trim Cut Top" and "Trim Cut Bottom" controls by setting their visibility to True using `Me![Trim Cut Top].Visible = True` and `Me![Trim Cut Bottom].Visible = True`, respectively.
**Other Cut Types**
* Set `Parting_Tool.Value` to 0.
* Set `Trim_Cut_Bottom.Value` to 0.
* Hide the "Parting Tool" control by setting its visibility to False using `Me![Parting Tool].Visible = False`.
* Hide the "Trim Cut Top" and "Trim Cut Bottom" controls by setting their visibility to False using `Me![Trim Cut Top].Visible = False` and `Me![Trim Cut Bottom].Visible = False`, respectively.
### Conclusion
When the "Cut Type" button is clicked, this code updates various properties and visibility settings of other controls in the worksheet based on the selected cut type.

View File

@ -0,0 +1,18 @@
# PemPress Ops subform
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Tables/SELECT DISTINCTROW [PemPress Ops].[PartNumber], [PemPress Ops].[OpCode], [PemPress Ops].[PemNumber], [PemPress Ops].[AutoManual], [PemPress Ops].[Hits] FROM [PemPress Ops];]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| OpCode | OpCode (from [[Tables/SELECT DISTINCTROW [PemPress Ops].[PartNumber], [PemPress Ops].[OpCode], [PemPress Ops].[PemNumber], [PemPress Ops].[AutoManual], [PemPress Ops].[Hits] FROM [PemPress Ops];]]) |
| Hits | Hits (from [[Tables/SELECT DISTINCTROW [PemPress Ops].[PartNumber], [PemPress Ops].[OpCode], [PemPress Ops].[PemNumber], [PemPress Ops].[AutoManual], [PemPress Ops].[Hits] FROM [PemPress Ops];]]) |
| Pem | PemNumber (from [[Tables/SELECT DISTINCTROW [PemPress Ops].[PartNumber], [PemPress Ops].[OpCode], [PemPress Ops].[PemNumber], [PemPress Ops].[AutoManual], [PemPress Ops].[Hits] FROM [PemPress Ops];]]) |
| Pem (Row Source) | [[Tables/[PemPress]] |
| Auto | AutoManual (from [[Tables/SELECT DISTINCTROW [PemPress Ops].[PartNumber], [PemPress Ops].[OpCode], [PemPress Ops].[PemNumber], [PemPress Ops].[AutoManual], [PemPress Ops].[Hits] FROM [PemPress Ops];]]) |
| Auto (Row Source) | [[Tables/[PemPress]] |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,72 @@
# Phantom Selection Screen
Analysis generated on: 4/1/2025 4:04:51 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button2_Click()
Call ckPrimaryScreen
ErrM.Caption = ""
Mater$ = itsaNull$(Phantom)
If Mater$ <> "" Then
DoCmd.OpenForm PrimaryScreen$, , , "PhantomNumber=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Material Selected"
End If
End Sub
Private Sub Button6_Click()
ErrM.Caption = ""
Mater$ = itsaNull$(Material)
If Mater$ <> "" Then
DoCmd.OpenReport "RSelectMaterial", A_PREVIEW, , "MetalType=" + Chr$(34) + Mater$ + Chr$(34)
Else
ErrM.Caption = "Invalid Material Selected"
End If
End Sub
```
## What it does
**Code Description**
This VBA code snippet appears to be part of an Access database application. It defines two event handlers for button clicks: `Button2_Click` and `Button6_Click`.
### Button2_Click
```markdown
**Button2_Click Event Handler**
```
* When the button with ID `Button2` is clicked, this subroutine is executed.
* The first line calls the `ckPrimaryScreen` procedure (not shown in the code snippet).
* It then clears any error message associated with `ErrM`.
* The value of `Material` ($Mater$) is checked for null using the `itsaNull$( )` function. If it's not null, a specific material number is used.
* Based on the presence or absence of a valid material number, two different actions are taken:
* If a valid material number is available, it opens a form named `PrimaryScreen` with the material number as a parameter.
* Otherwise, an error message "Invalid Material Selected" is displayed.
### Button6_Click
```markdown
**Button6_Click Event Handler**
```
* Similar to `Button2_Click`, when the button with ID `Button6` is clicked, this subroutine is executed.
* It clears any existing error message in `ErrM`.
* The value of `Material` ($Mater$) is checked for null using the `itsaNull$( )` function. If it's not null, a specific metal type is used.
* Based on the presence or absence of a valid material number, this action:
* Opens a report named `RSelectMaterial` with the metal type as a parameter and preview mode enabled.
* Otherwise, an error message "Invalid Material Selected" is displayed.
**Key Observations:**
* The code uses Access database-specific functions like `DoCmd.OpenForm`, `DoCmd.OpenReport`, and `ErrM.Caption`.
* It employs string concatenation using the `$` symbol to build parameters for form and report openings.
* Error handling and material validation mechanisms ensure that only valid inputs are used in subsequent operations.

View File

@ -0,0 +1,18 @@
# PressBrakeSubForm
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Queries/PressBrakeQ1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Opcode | OpCode (from [[Queries/PressBrakeQ1]]) |
| Angle | Angle (from [[Queries/PressBrakeQ1]]) |
| Breaks | Breaks (from [[Queries/PressBrakeQ1]]) |
| Hits | Hits (from [[Queries/PressBrakeQ1]]) |
| Step | Step (from [[Queries/PressBrakeQ1]]) |
| Comment | Comment (from [[Queries/PressBrakeQ1]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

704
Forms/Process Sheet test.md Normal file
View File

@ -0,0 +1,704 @@
# Process Sheet test
Analysis generated on: 4/1/2025 4:01:17 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse |
| Field325 (Row Source) | |
| BlankSize | BlankSize |
| PartSize | PartSize |
| GrossWt | GrossWt |
| ActualWt | ActualWt |
| Utilization | Utilization |
| SheetSize | SheetSize |
| GrainDir | GrainDir |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet |
| BlanksPerBlock | BlanksPerBlock |
| PartsPerSheet | PartsPerSheet |
| ActualPartHeight | ActualPartHeight |
| PartCost | PartCost |
| Field238 | PartsPerBlank |
| PartNumber | PartNumber |
| PartName | PartName |
| IssueNumber | IssueNumber |
| IssueDate | IssueDate |
| PreviousIssue | PreviousIssue |
| PreviousDate | PreviousDate |
| Programmer | Programmer |
| PrintSize | PrintSize |
| History | History |
| MetalType | MetalType |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim |
| SecDim | SecDim |
| BotTrimCut | BotTrimCut |
| TopTrimCut | TopTrimCut |
| CutType | CutType |
| CutType (Row Source) | |
| Deburr | Deburr |
| Deburr (Row Source) | |
| PartWidth | PartWidth |
| ActualPartWidth | ActualPartWidth |
| PartsPerBlank | PartsPerBlank |
| PressBrake | PressBrake |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight |
| Field240 | CellDeburrTypes |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches |
| Reason | Reason |
| PunchPressOption | PunchOption |
| PunchCount | PunchPartsPerStrip |
| PunchDie | PunchNumber |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear |
| PunchStd | PunchStd |
| PhantomNumber | PhantomNumber |
| Gr3 | GrainNone |
| PaperLaserFlag | PaperLaserFlag |
| Pems | PemPress |
| PemBefore | PemBefore |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
On Error GoTo button288_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
DoCmd.Hourglass True
Call diskout
DoCmd.Hourglass False
End Sub
Private Sub Button324_Click()
'add a data sheet for Eugene!!!
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
# VBA Code Description
## Overview
This VBA code is written for Microsoft Access and appears to be part of an application that manages parts, tools, and machines. The code is organized into several modules, each handling specific tasks.
## Module 1: Button Click Events
### `addPr_Click()`
* Creates a new part with the name "NEW" and calls the `AddPartButton()` subroutine.
* Uses the database order for string comparisons to ensure accurate results.
### `Button184_Click()`
* Calls the `Add_Additional_Process()` subroutine, which is not defined in this code snippet.
* Handles the error by displaying an error message and resuming the execution of the current subroutine.
### `Button190_Click()`
* Attempts to quit the application with a "DoCmd.Quit" command.
* If an error occurs, displays an error message using the `MsgBox` function and resumes the execution of the current subroutine.
### `Button193_Click()`
* Retrieves the part number from the form's control "PartNumber".
* Calls the `AddPartButton()` subroutine with the retrieved part number.
* Uses the database order for string comparisons to ensure accurate results.
### `Button194_Click()`
* Attempts to print a report using the `DoCmd.PrintOut` command.
* If an error occurs, displays an error message and resumes the execution of the current subroutine.
* Calls the `Refresh()` method to update the form's controls.
### `Button196_Click()`
* Checks if the calculation status is not zero before printing a report.
* If the calculation status is zero, displays an error message and exits the subroutine.
* Calls the `Refresh()` method to update the form's controls.
* Opens a report named "Process Sheet Print" using the `DoCmd.OpenReport` command.
## Module 2: Database Operations
### `search()`
* Searches for a machine in the database with the same part number as the current part.
* If found, adds a new record to the machines table.
* Returns a boolean value indicating whether the search was successful (`True`) or not (`False`).
## Module 3: Form Operations
### `Button224_Click()`
* Opens a form named "Data Sheet Select" using the `DoCmd.OpenForm` command.
* Searches for records in the database with the same part number as the current part.
* If found, selects an object from the primary screen using the `DoCmd.SelectObject` command.
### `Button246_Click()`
* Calls the `HistoryR()` subroutine, which is not defined in this code snippet.
### `Button247_Click()`
* Opens a form named "YESORNO" using the `DoCmd.OpenForm` command.
* Displays a message box asking for confirmation to delete the part.
* If confirmed, calls the `Delete_Part()` subroutine to delete the part.
### `Button248_Click()`
* Calls the `Edit_The_Shear_Files()` subroutine, which is not defined in this code snippet.
### `Button249_Click()`
* Calls the `Find_By_PartNumber()` subroutine, which is not defined in this code snippet.
### `Button288_Click()`
* Retrieves the part number from the form's control "PartNumber".
## Notes
* The `Add_Additional_Process` and `Edit_The_Shear_Files` subroutines are not defined in this code snippet.
* The `HistoryR`, `Find_By_PartNumber`, and `Delete_Part` procedures are not defined in this code snippet.
* This code appears to use several databases, including "MainDB", "MachNamesDB", and "MachQDB".
* The code uses various commands, such as `DoCmd.Quit`, `DoCmd.PrintOut`, `DoCmd.OpenForm`, and `DoCmd.Close` to interact with the database and form objects.

1044
Forms/Process Sheet.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
# Restart Process Sheet
Analysis generated on: 4/1/2025 4:06:13 PM
---
## Record Source
- [[Tables/Process]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Tables/Process]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Form_Timer()
On Error GoTo Err_Button0_Click
Dim DocName As String
Dim LinkCriteria As String
PN$ = Me!PartNumber
DocName = PrimaryScreen$
DoCmd.OpenForm DocName, , , LinkCriteria
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
DoCmd.FindRecord PN$
DoCmd.SelectObject A_FORM, "Restart Process Sheet"
DoCmd.Close
Exit_Button0_Click:
Exit Sub
Err_Button0_Click:
MsgBox Error$
Resume Exit_Button0_Click
End Sub
```
## What it does
**VBA Code Description**
==========================
### Overview
This VBA code is designed to run on a regular interval (via the `Form_Timer` event) and performs several tasks related to database management and form interaction.
### Key Components
#### 1. Error Handling
The code uses an error handling mechanism (`On Error GoTo Err_Button0_Click`) to catch any errors that may occur during execution. If an error is encountered, a message box will display the error message (`MsgBox Error$`), and the code will attempt to continue executing from the `Exit_Button0_Click` label.
#### 2. Form Timer Event
The code leverages the `Form_Timer` event, which is triggered at regular intervals (in this case, it's not specified how often, but it's likely set to a specific time interval). This allows the code to run repeatedly without requiring manual intervention.
#### 3. Database Interaction
The code performs several database interactions:
* It retrieves the current value of `Me!PartNumber` and stores it in the `PN$` variable.
* It sets the `DocName` variable to the value of `PrimaryScreen$`.
* It uses the `DoCmd.OpenForm` method to open a form specified by `DocName`, with a link criteria specified by the `LinkCriteria` string. However, `LinkCriteria` is not defined in this code snippet.
* It navigates the form to specific controls using `DoCmd.GoToControl`: "PartName" and "PartNumber".
* It uses the `DoCmd.FindRecord` method to find a record with the value of `PN$`.
* It selects an object from a database, specifying a form name ("Restart Process Sheet") and selecting a specific field (`A_FORM`).
#### 4. Form Closure
After completing its tasks, the code closes the currently open form using `DoCmd.Close`.
### Assumptions and Context
This code appears to be part of a larger application that utilizes Microsoft Access's database features. The context in which this code is deployed is likely an application with multiple forms, some of which may require frequent updates or processing. The specific details of the database schema and form structures are not provided within this code snippet.
### Improvements and Suggestions
* Define the `LinkCriteria` string to ensure proper linking between the open form and other records in the database.
* Consider adding logging or debugging statements to help understand the behavior of the code, especially when encountering errors.
* Review the database schema and forms involved to optimize performance and efficiency.
* Ensure that the `PN$` variable is correctly validated for potential data corruption or invalid input.

1169
Forms/SP Delete.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,178 @@
# Scott's Utilization of C6-C9
Analysis generated on: 4/1/2025 4:07:47 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub Command0_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Selecting Parts for Scott"
Refresh
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Scott'sQ3") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
lblstatus.Caption = "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!parts
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
' UtilResult1.SourceObject = "tricks"
DoCmd.OpenQuery "Scott'sQ4"
' UtilResult1.SourceObject = "Util Result1"
' lblStatus.Caption = "Calculating material utilization on parts"
lblstatus.Caption = "Done"
End Sub
```
## What it does
**VBA Code Description**
========================
### Overview
This VBA code is designed to automate a series of tasks related to part management and data transfer between Microsoft Access databases. The code is triggered by a click event on a command button (Command0) in an Access form.
### Code Structure
The code consists of several sections, each responsible for a specific task:
1. **Initialization**
* Sets up the database connections and recordsets.
2. **Data Purging**
* Moves data from one table to another, purging the target table of duplicates.
3. **Data Transfer**
* Transfers data from another table to the first table, using a product number file as a reference.
4. **AS400 Program Activation**
* Triggers an action in an external system (AS400) by clicking a button on the form.
5. **Results Retrieval**
* Opens a query to retrieve results from the Access database.
### Detailed Breakdown
#### Initialization
```markdown
Option Compare Database
Private Sub Command0_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
```
The code sets up two database connections (`MainDB` and `MainDB2`) and creates recordsets for each.
#### Data Purging
```markdown
lblstatus.Caption = "Selecting Parts for Scott"
Refresh
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Scott'sQ3") ' Create dynaset.
MainSet.MoveFirst
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
```
The code moves data from the `RMSFILES#_IEMUP1A0` table in `MainDB` to the `Scott'sQ3` table in `MainDB2`, purging duplicates.
#### Data Transfer
```markdown
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
p$ = MainSet!parts
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
```
The code transfers data from the `RMSFILES#_IEMUP1A0` table in `MainDB2` to the first table, using a product number file as a reference.
#### AS400 Program Activation
```markdown
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
```
The code activates an action in an external system (AS400) by clicking a button on the form.
#### Results Retrieval
```markdown
lblstatus.Caption = "Retrieving Results"
' UtilResult1.SourceObject = "tricks"
' lblStatus.Caption = "Calculating material utilization on parts"
DoCmd.OpenQuery "Scott'sQ4"
' ... (no further code executed)
```
The code opens a query to retrieve results from the Access database.
### Conclusion
This VBA code automates a series of tasks related to part management and data transfer between Microsoft Access databases. The code is designed to be robust and flexible, handling errors and edge cases as needed.

95
Forms/SetupPaths.md Normal file
View File

@ -0,0 +1,95 @@
# SetupPaths
Analysis generated on: 4/1/2025 4:07:36 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button6_Click()
Sheet1path$ = Trim$(itsaNull$(Shear1Path))
Sheet2path$ = Trim$(itsaNull$(Shear2Path))
Initforms$ = Trim$(itsaNull$(InitForm))
Open ShearsName For Output As #1
Print #1, Sheet1path$
Print #1, Sheet2path$
Print #1, Initforms$
Close #1
DoCmd.Close
End Sub
Private Sub Button7_Click()
DoCmd.Close
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrorRead
Open ShearsName For Input As #1
Line Input #1, i$: Sheet1path$ = i$
Line Input #1, i$: Sheet2path$ = i$
Line Input #1, i$: Initforms$ = i$
Close #1
Shear1Path = Trim$(Sheet1path$)
Shear2Path = Trim$(Sheet2path$)
InitForm = Trim$(Initforms$)
Exit Sub
ErrorRead:
i$ = ""
Resume Next
End Sub
```
## What it does
**VBA Code Description**
=========================
### Overview
This VBA code is written for an Access database application and appears to be part of a form's event handler. The code handles two button clicks: `Button6_Click` and `Button7_Click`. Additionally, the `Form_Open` subroutine is defined to handle the form's opening event.
### Button6_Click Subroutine
------------------------------
This subroutine is triggered when the `Button6` control is clicked. Its primary function is to:
1. **Trim and validate input strings**: The code trims any leading or trailing whitespace from three string variables: `Sheet1path`, `Sheet2path`, and `Initforms$. The trim operation is performed using the `Trim()` function.
2. **Open a file for output**: A file named `ShearsName` is opened in output mode (`For Output As #1`) using the `DoCmd.OpenObject` method.
3. **Write input strings to the file**: The trimmed string values are written to the file using the `Print #1, StringValue` statement.
4. **Close the file**: After writing all the values, the file is closed using the `Close #1` statement.
### Button7_Click Subroutine
------------------------------
This subroutine is triggered when the `Button7` control is clicked. Its primary function is to:
1. **Close the current form**: The code uses the `DoCmd.Close` method to close the current form.
### Form_Open Subroutine
-------------------------
This subroutine is called when the form is opened, either by double-clicking on its icon or programmatically using another VBA script. Its primary function is to:
1. **Handle potential errors**: If an error occurs during file input/output operations, the code jumps to the `ErrorRead` label and sets a default value (`i$ = ""`) for the `Sheet1path`, `Sheet2path`, or `Initforms$` variables.
2. **Open the file for input**: A file named `ShearsName` is opened in input mode (`For Input As #1`) using the `DoCmd.OpenObject` method.
3. **Read and trim input strings**: The code reads three line inputs from the file, assigning them to the corresponding variables (`i$ = Sheet1path`, `i$ = Sheet2path`, etc.). The trimmed values are stored in the original variable names.
4. **Update form controls**: After reading all the values, the code updates three form control variables: `Shear1Path`, `Shear2Path`, and `InitForm` by assigning the trimmed string values.
### ErrorRead Label
--------------------
If an error occurs during file input/output operations, the code jumps to this label. Here, the value of `i$` is set to an empty string (`""`). The `Resume Next` statement then skips to the next instruction (in this case, `Line Input #1, i$: ...`) to try reading from the next line in the file.
### Best Practices
The code could benefit from additional error handling and input validation. For example:
* Use `DoCmd.OpenRecordset` instead of `DoCmd.OpenObject` for more flexibility.
* Implement a loop to handle multiple lines of data, rather than assuming only one line is available.
* Validate user input (e.g., check if the file exists or if it's in the correct format) before attempting to read from it.

View File

@ -0,0 +1,13 @@
# Sheet Metal Weight
Analysis generated on: 4/1/2025 4:03:52 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,160 @@
# Sheet Utilization Utilites
Analysis generated on: 4/1/2025 4:02:30 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Option Explicit
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim frm As Form
Dim stDocName As String
Dim stLinkCriteria As String
Call ckPrimaryScreen
stDocName = PrimaryScreen$
DoCmd.OpenForm stDocName
For Each frm In Forms
If frm.name = stDocName Then
Exit For
End If
Next
frm.recordSource = "Processes by List"
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Sheet_Utilization_Click()
On Error GoTo Err_Sheet_Utilization_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Utilization on Multiple Sheets"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Sheet Utilization Utilites"
Exit_Sheet_Utilization_Click:
Exit Sub
Err_Sheet_Utilization_Click:
MsgBox Err.Description
Resume Exit_Sheet_Utilization_Click
End Sub
Private Sub Sort_by_Machine_Click()
On Error GoTo Err_Sort_by_Machine_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sorted by Machine"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Sort_by_Machine_Click:
Exit Sub
Err_Sort_by_Machine_Click:
MsgBox Err.Description
Resume Exit_Sort_by_Machine_Click
End Sub
Private Sub Open_Form_Click()
On Error GoTo Err_Open_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Filtered Parts"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Sheet Utilization Utilites"
Exit_Open_Form_Click:
Exit Sub
Err_Open_Form_Click:
MsgBox Err.Description
Resume Exit_Open_Form_Click
End Sub
Private Sub Sheet_Metal_Weight_Click()
On Error GoTo Err_Sheet_Metal_Weight_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sheet Metal Weight"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Sheet Utilization Utilites"
Exit_Sheet_Metal_Weight_Click:
Exit Sub
Err_Sheet_Metal_Weight_Click:
MsgBox Err.Description
Resume Exit_Sheet_Metal_Weight_Click
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is designed for a Microsoft Access application, specifically targeting the Form Controls feature. It provides event-driven macros that interact with various forms to perform specific tasks.
### Overview
The code consists of five separate subroutines, each handling the click event of a button or command button in an Access form:
1. `Command16_Click`
2. `Sheet_Utilization_Click`
3. `Sort_by_Machine_Click`
4. `Open_Form_Click`
5. `Sheet_Metal_Weight_Click`
Each subroutine performs a distinct function when triggered by its respective button click.
### Common Pattern
A common pattern is observed across all subroutines:
1. The subroutine begins with an `On Error GoTo Err_\u003cSubroutine_Name\u003e` statement, which sets the error handling mechanism to resume execution from the specified label (`Err_\u003cSubroutine_Name\u003e`) in case of an error.
2. It initializes variables: `stDocName` and `stLinkCriteria`, which hold the names of forms and link criteria used for data retrieval or filtering.
3. The subroutine performs form-related operations:
* Opens a specific form using `DoCmd.OpenForm stDocName, , , stLinkCriteria`.
* Retrieves any existing instances of the specified form using `For Each frm In Forms` and checks if they match the `stDocName`.
* Sets the record source of an instance to "Processes by List" or closes a specific form.
4. If errors occur during execution, the subroutine displays an error message box with the description of the error using `MsgBox Err.Description`.
### Subroutine-Specific Functions
Here's a brief description of each subroutine's function:
1. **`Command16_Click`**:
* Opens the "Primary Screen" form and ensures only one instance is active.
* Sets the record source to "Processes by List".
2. **`Sheet_Utilization_Click`**:
* Opens the "Utilization on Multiple Sheets" form and closes an existing instance of "Sheet Utilization Utilities".
3. **`Sort_by_Machine_Click`**:
* Opens the "Sorted by Machine" form without specifying any link criteria.
4. **`Open_Form_Click`**:
* Opens the "Filtered Parts" form with a specified link criterion, which is currently commented out (`stLinkCriteria`).
5. **`Sheet_Metal_Weight_Click`**:
* Similar to `Sort_by_Machine_Click`, opens the "Sheet Metal Weight" form without specifying any link criteria.
### Conclusion
In summary, this VBA code provides event-driven functionality for Access forms, allowing users to interact with various controls and perform specific tasks when buttons are clicked. The code follows a consistent pattern, handling errors gracefully while executing its respective functions.

View File

@ -0,0 +1,162 @@
# Sorted by Machine old
Analysis generated on: 4/1/2025 4:01:48 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| Machine Name (Row Source) | [[Tables/[MachineNames];]] |
## VBA Code
```vba
Private Sub Command2_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
Command2.Tag = Command2.Caption
Command2.Caption = "Processing"
Edit_Table.Enabled = False
' DoEvents
' lblstatus.Caption = "Selecting Parts for Material Utilization"
'DoCmd.RunMacro "Material Selections for Utilitzation"
'lblstatus.Caption = "Selection Complete"
Refresh
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Sorted By Machines 1") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
lblstatus.Caption = "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
UtilResult2.SourceObject = "tricks"
DoCmd.RunMacro "AS400 Utiliz Results for steve"
UtilResult2.SourceObject = "Util Result2"
lblstatus.Caption = "Calculating material utilization on parts"
lblstatus.Caption = "Done"
Command2.Caption = Command2.Tag
Edit_Table.Enabled = True
End Sub
Private Sub Machine_Name_BeforeUpdate(Cancel As Integer)
Command2.Enabled = False
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "Sort by Machine"
DoCmd.SetWarnings (True)
Command2.Enabled = True
End Sub
Private Sub Edit_Table_Click()
On Error GoTo Err_Edit_Table_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Util Selection C1"
Set MyForm = Screen.ActiveForm
DoCmd.OpenTable stDocName, acViewNormal
Exit_Edit_Table_Click:
Exit Sub
Err_Edit_Table_Click:
MsgBox Err.Description
Resume Exit_Edit_Table_Click
End Sub
Private Sub Refresh_Click()
UtilResult2.SourceObject = "tricks"
UtilResult2.SourceObject = "Util Result2"
End Sub
```
## What it does
**VBA Code Description**
========================
### Overview
This VBA code is used to automate a process of material utilization for parts in an inventory management system. It interacts with an Access database, an AS400 server, and various forms to collect and process data.
### Command2_Click Procedure
This procedure is triggered when the user clicks on the "Command2" button. Its primary function is to initiate the material utilization process by:
1. Setting up database connections and recordsets.
2. Purging the AS400 product number file.
3. Moving parts to the AS400 server.
4. Activating an AS400 program.
5. Retrieving results from the AS400 server.
6. Calculating material utilization on parts.
**Step-by-Step Breakdown:**
* Connects to the database and sets up recordsets for "RMSFILES#_IEMUP1A0" and "Sorted By Machines 1".
* Purges the AS400 product number file by deleting records from the first recordset.
* Moves parts to the AS400 server by adding new records to the second recordset with the corresponding part numbers.
* Activates an AS400 program using `ActiveXCtl24.DoClick`.
* Retrieves results from the AS400 server using a macro.
* Calculates material utilization on parts.
### Machine_Name_BeforeUpdate Procedure
This procedure is used to restrict user input when editing the "Machine Name" field. It disables the "Command2" button and sets warnings to false while opening the "Sort by Machine" query. Once the query is closed, it re-enables the "Command2" button.
### Edit_Table_Click Procedure
This procedure is triggered when the user clicks on the "Edit Table" button. Its primary function is to:
1. Open the specified table ("Util Selection C1") in edit mode.
2. If any errors occur during editing, it displays an error message and exits.
### Refresh_Click Procedure
This procedure is used to refresh the data in the "Util Result2" form. It simply sets the source object of `UtilResult2` to "tricks" or "Util Result2".
**Key Features:**
* Interacts with Access database, AS400 server, and various forms.
* Automates material utilization process using macros and recordsets.
* Restricts user input when editing machine names.
* Handles errors during table editing and refreshes data in the "Util Result2" form.

207
Forms/Sorted by Machine.md Normal file
View File

@ -0,0 +1,207 @@
# Sorted by Machine
Analysis generated on: 4/1/2025 4:07:22 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| Machine Name (Row Source) | [[Tables/[MachineNames];]] |
## VBA Code
```vba
Private Sub Command2_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
Command2.Tag = Command2.Caption
Command2.Caption = "Processing"
Edit_Table.Enabled = False
' DoEvents
' lblstatus.Caption = "Selecting Parts for Material Utilization"
'DoCmd.RunMacro "Material Selections for Utilitzation"
'lblstatus.Caption = "Selection Complete"
Refresh
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Sorted By Machines 1") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
On Error Resume Next
MainSet.MoveFirst
On Error GoTo 0
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
lblstatus.Caption = "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
UtilResult2.SourceObject = "tricks"
DoCmd.RunMacro "AS400 Utiliz Results for steve"
UtilResult2.SourceObject = "Util Result2"
lblstatus.Caption = "Calculating material utilization on parts"
lblstatus.Caption = "Done"
Command2.Caption = Command2.Tag
Edit_Table.Enabled = True
End Sub
Private Sub Machine_Name_BeforeUpdate(Cancel As Integer)
Command2.Enabled = False
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "Sort by Machine"
DoCmd.SetWarnings (True)
Command2.Enabled = True
End Sub
Private Sub Edit_Table_Click()
On Error GoTo Err_Edit_Table_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Util Selection C1"
Set MyForm = Screen.ActiveForm
DoCmd.OpenTable stDocName, acViewNormal
Exit_Edit_Table_Click:
Exit Sub
Err_Edit_Table_Click:
MsgBox Err.Description
Resume Exit_Edit_Table_Click
End Sub
Private Sub Refresh_Click()
UtilResult2.SourceObject = "tricks"
UtilResult2.SourceObject = "Util Result2"
End Sub
```
## What it does
**Command2_Click Subroutine**
==========================
This subroutine is triggered when the Command2 button is clicked. It performs a series of operations related to material utilization and AS400 integration.
### Initialization
* Retrieves the first database (`MainDB`) and second database (`MainDB2`) from the list in the current workspace.
* Sets the `Tag` property of the Command2 button to its current caption and changes it to "Processing".
* Disables the Edit Table control to prevent any accidental modifications during the processing.
* Calls the `Refresh` subroutine to update the UI.
### Material Utilization Processing
* Retrieves two Recordsets (`MainSet` and `MainSet2`) from the first database, which contain data for material utilization and AS400-related information, respectively.
* Purges the AS400 product number file by deleting all records in the `Sorted By Machines 1` Recordset. This is done using a loop that moves through each record, deletes it if it's not at the end of the Recordset, and then continues to the next record.
* Inserts new records into the `PRDNO` field of the `MainSet` Recordset based on the product number in the AS400 file. This is done using a loop that moves through each record in the `Sorted By Machines 1` Recordset, extracts the product number, adds it to the `MainSet`, and then updates the Recordset.
### AS400 Program Activation
* Disables any warnings in the database for the next 10 seconds.
* Opens a query called "Sort by Machine" using `DoCmd.OpenQuery`.
* Enables the Command2 button again after the warning period has expired.
### Result Retrieval and Calculation
* Updates the source object of the `UtilResult2` control to "tricks".
* Runs a macro called "AS400 Utiliz Results for steve" to retrieve results from AS400.
* Updates the source object of the `UtilResult2` control to "Util Result2".
### Finalization
* Changes the caption of the Command2 button back to its original value and re-enables the Edit Table control.
**Machine_Name_BeforeUpdate Subroutine**
=====================================
This subroutine is triggered when the user attempts to update the Machine Name in the Sort by Machine query. It ensures that the Command2 button remains disabled until the warning period has expired after opening the query.
### Code Snippet:
```vba
Private Sub Machine_Name_BeforeUpdate(Cancel As Integer)
Command2.Enabled = False
DoCmd.SetWarnings (False)
DoCmd.OpenQuery "Sort by Machine"
DoCmd.SetWarnings (True)
Command2.Enabled = True
End Sub
```
**Edit_Table_Click Subroutine**
=============================
This subroutine is triggered when the Edit Table button is clicked. It handles any errors that occur during editing and provides a user-friendly message to the user.
### Code Snippet:
```vba
Private Sub Edit_Table_Click()
On Error GoTo Err_Edit_Table_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Util Selection C1"
Set MyForm = Screen.ActiveForm
Exit_Edit_Table_Click:
Exit Sub
Err_Edit_Table_Click:
MsgBox Err.Description
Resume Exit_Edit_Table_click
End Sub
```
**Refresh_Click Subroutine**
=========================
This subroutine is triggered when the Refresh button is clicked. It updates the source object of the `UtilResult2` control to both "tricks" and "Util Result2".
### Code Snippet:
```vba
Private Sub Refresh_Click()
UtilResult2.SourceObject = "tricks"
UtilResult2.SourceObject = "Util Result2"
End Sub
```
In summary, this code provides a comprehensive workflow for material utilization processing, including data retrieval from databases, integration with AS400, and result calculation. The subroutines handle user interactions, errors, and UI updates to provide a seamless experience.

921
Forms/T.md Normal file
View File

@ -0,0 +1,921 @@
# T
Analysis generated on: 4/1/2025 4:02:48 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/metalQ1;]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
| Pems | PemPress (from [[Queries/UniversalQ]]) |
| PemBefore | PemBefore (from [[Queries/UniversalQ]]) |
| STSCode | STSCode (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
If Left$(Initforms$, 2) = "14" Then
DocName = "Process Sheet Print 14"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
Else
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1"
End If
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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
Programmer.SetFocus
End Sub
Private Sub Button247_Click()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
' On Error GoTo button288_error
DoCmd.GoToRecord , , acNext
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
'Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
Button322.Caption = "Processing"
DoCmd.Hourglass True
Call diskout
Call UpdateGWs
DoCmd.Hourglass False
Button322.Caption = "Create Disk Output"
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmd300Series_Click()
DoCmd.Hourglass True
Set XrefQDB = DBEngine.Workspaces(0).Databases(0)
Set XrefQSet = XrefQDB.OpenRecordset("RMSFILES#_EGSSP1A0", DB_OPEN_DYNASET) ' Create dynaset.
XrefQSet.MoveFirst
PartN$ = currform![PartNumber]
xPN$ = Left(currform![PartNumber], 7)
newnum$ = ""
Do Until XrefQSet.EOF
If (Trim(XrefQSet!CURPN) = xPN$) Then
newnum$ = Trim(XrefQSet!NEWPN)
If newnum$ <> "" Then
newnum$ = newnum$ + Right(Trim(PartN$), 1)
End If
Exit Do
End If
XrefQSet.MoveNext
Loop
If newnum$ <> "" Then
Curprt$ = Directory$ + "VLT1\" + revext(PartN$)
If Exists(Curprt$) Then
NewPrt$ = Directory$ + "VLT1\" + revext(newnum$)
Open Curprt$ For Input As #1
Open NewPrt$ For Output As #2
While Not EOF(1)
Line Input #1, A$
If InStr(A$, PartN$) <> 0 Then
A$ = ReplaceStr(A$, PartN$, newnum$)
End If
Print #2, A$
Wend
Close #1, #2
End If
Curprt$ = Directory$ + "VT2\" + revext(PartN$)
If Exists(Curprt$) Then
NewPrt$ = Directory$ + "VT2\" + revext(newnum$)
Open Curprt$ For Input As #1
Open NewPrt$ For Output As #2
While Not EOF(1)
Line Input #1, A$
If InStr(A$, PartN$) <> 0 Then
A$ = ReplaceStr(A$, PartN$, newnum$)
End If
Print #2, A$
Wend
Close #1, #2
End If
End If
DoCmd.Hourglass False
End Sub
Function revext(p$)
revext = Left(p$, 7) + "." + Right(p$, 1)
End Function
Public Function ReplaceStr$(source$, Target$, Replc$)
'
'Replaces each instance of the string Target$ with the string Replc$ in the string Source$
'
NS$ = source$
FromPl% = 1
While InStr(Mid$(UCase$(NS$), FromPl%), UCase$(Target$)) <> 0
A% = InStr(Mid$(UCase$(NS$), FromPl%), UCase$(Target$))
A% = A% + FromPl% - 1
NS$ = Left$(NS$, A% - 1) + Replc$ + Mid$(NS$, A% + Len(Target$))
FromPl% = A% + Len(Replc$)
Wend
ReplaceStr$ = NS$
End Function
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
End Sub
Private Sub Command357_Click()
DoCmd.Hourglass True
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Sub UpdateGWs()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
' currform.Refresh
PN$ = currform!PartNumber
PN$ = Left$(PN$, 7)
wh$ = currform!Warehouse
Set Main2Set = MainDB.OpenRecordset("RMSFILES#_MFWKP795", DB_OPEN_DYNASET) ' Create dynaset.
On Error Resume Next
Main2Set.MoveFirst
On Error GoTo 0
Users$ = Trim(myNTUserName$)
Do
If Not (Main2Set.EOF) Then
If Trim$(Main2Set![UID]) = Users$ Then
Main2Set.Delete
End If
DoEvents
Else
DoEvents
Exit Do
End If
Main2Set.MoveNext
Loop
Gws$ = Format(itsaNull$(currform!GrossWt), "#.000")
aws$ = Format(itsaNull$(currform!ActualWt), "#.000")
matl$ = currform!Field113.Column(2)
pps$ = currform!PartsPerSheet
If currform!PartsPerBlank.Visible = True Then
ppb$ = currform!PartsPerBlank
Else
ppb$ = currform!BlanksPerBlock
End If
Main2Set.AddNew
Main2Set![UID] = Users$
Main2Set!PRDNO = PN$
Main2Set!KBLWH = wh$
Main2Set!netwt = aws$
Main2Set!GRSwt = Gws$
Main2Set![MATL#] = matl$
Main2Set!SSIZE3 = pps$
Main2Set!BSIZE3 = ppb$
Main2Set.Update
Main2Set.Close
MainDB.Close
'ActiveXCtl358.CommandString = "Call PGM(MFR795) PARM('" + Users$ + "')"
'currform!ActiveXCtl358.DoClick
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
lblXrefMessage.Visible = False
cmd300Series.Visible = False
Call CrossRef
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
If Left$(Initforms$, 2) = "14" Then
DocName$ = "14" + Chr$(34) + " Process Sheet"
Else
DocName$ = "Process Sheet"
End If
PrimaryScreen$ = DocName$
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for what happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Filtered Parts"
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub Info_Click()
Call gatherinfo
Button246.SetFocus
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PartNumber_GotFocus()
' If itsaNull(PartName) = "" Then
'Info.Visible = True
'Else
'Info.Visible = False
'End If
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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 Programmer_LostFocus()
A$ = Me![Programmer]
If A$ = "SG" Or A$ = "CB" Or A$ = "ST" Or A$ = "KL" Then
Checkupload = True
Else
Checkupload = False
End If
End Sub
Private Sub PunchDie_AfterUpdate()
If (PunchDie = "!NONE!") Or (Trim$(PunchDie) = "") Then
PunchPressOption.Visible = False
PunchCount.Visible = False
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
Sub gatherinfo()
Dim arrray$(100)
'Part$ = txtPartNumber 'hide when trying itsazero
'Min$ = LTrim(Left$(a$, 2))
Part1$ = Trim(Left$(PartNumber, 7))
Part2$ = Trim(Right$(PartNumber, 1))
Part$ = itsaNull(Part1$ + "." + Part2$)
If Exists("\\fryfs002v\ie1\sys\shoplink\vt2\" & Part$) Then
Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vt2\" & Part$)
PartName.Value = Cull2(arrray$(), "(PART NAME :", "0")
Reason.Value = Cull2(arrray(), "(JOB NUMBER :", "0")
End If
If Exists("\\fryfs002v\ie1\sys\shoplink\vlt1\" & Part$) Then
Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\vlt1\" & Part$)
PartName.Value = Cull(arrray$(), "(PART NAME :", "0")
Reason.Value = Cull(arrray(), "(JOB NUMBER :", "0")
End If
'If PartName = 0 Or itsaNull(PartName) = "" Then
'Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vt2\" & Part$)
'PartName.Value = Cull2(arrray$(), "(PART NAME :", "0")
'Reason.Value = Cull2(arrray(), "(JOB NUMBER :", "0")
'End If
'If PartName = 0 Or itsaNull(PartName) = "" Then
'Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vlt1\" & Part$)
'PartName.Value = Cull(arrray$(), "(PART NAME :", "0")
'Reason.Value = Cull(arrray(), "(JOB NUMBER :", "0")
'End If
'xxx$ = Cull(arrray$(), "FormWidth", "0")
'frmmain.Width = Val(xxx$)
End Sub
```
## What it does
**VBA Code Description**
=========================
This VBA code is written for an Access database application and appears to be part of a larger system for managing parts, machines, and processes. The code is organized into several subroutines that respond to button clicks.
### Subroutine 1: `addPr_Click`
* Triggers when the "Add Pr" button is clicked.
* Calls the `AddPartButton` subroutine with a default part name ("NEW").
### Subroutine 2: `Button184_Click`
* Triggers when the "Process Additional" button is clicked.
* Calls the `Add_Additional_Process` subroutine.
### Subroutine 3: `Button190_Click`
* Triggers when the "Quit" button is clicked.
* Attempts to quit the application, but with error handling:
* Displays an error message if an issue occurs.
* Resumes executing the current code path.
### Subroutine 4: `Button193_Click`
* Triggers when the "Part Number" button is clicked.
* Calls the `AddPartButton` subroutine and passes the current part number as an argument.
### Subroutine 5: `Button194_Click`
* Triggers when the "Print Report" button is clicked.
* Checks if there's a calculation status error:
* If true, displays an error message and exits.
* Otherwise, refreshes the form and opens the "Process Sheet Print" report.
### Subroutine 6: `Button196_Click`
* Triggers when the "Print Process Sheet" button is clicked.
* Checks if there's a calculation status error:
* If true, displays an error message and exits.
* Otherwise, refreshes the form, opens the "Process Sheet Print 14" report (if applicable), or the standard "Process Sheet Print" report.
### Subroutine 7: `Button200_Click`
* Triggers when the "Process Machines" button is clicked.
* Opens database connections to three tables:
* `MainDB`: The main database.
* `MachNamesDB`: A database containing machine names.
* `MachQDB`: A database containing machine queries.
* Performs a loop that iterates over the machines in the `MachineNames` table:
* Seeks for the specified part number in the `Machines` table using an index.
* If found, adds a new record to the `Machines` table with the corresponding machine name and tool information.
### Subroutine 8: `Button244_Click`
* Triggers when the "Data Sheet Select" button is clicked.
* Opens the data sheet form with a link criteria that finds records based on the current part number.
* Seeks for the specified part number in the primary screen's `CalculationStatus` field:
* If found, opens the corresponding record in the primary screen.
### Subroutine 9: `Button246_Click`
* Triggers when the "History" button is clicked.
* Calls the `HistoryR` subroutine and sets focus to the programmer.
### Subroutine 10: `Button247_Click`
* Triggers when the "YESORNO" button is clicked.
* Opens the YES/NO form with a delete part message.
* Loops until a response of 1 is entered:
* Displays the form until an input is made.
### Subroutine 11: `Button248_Click`
(This subroutine appears to be incomplete and has not been implemented.)
Overall, this code provides functionality for managing parts, machines, and processes within an Access database application.

824
Forms/TRASH.md Normal file
View File

@ -0,0 +1,824 @@
# TRASH
Analysis generated on: 4/1/2025 4:05:15 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/metalQ1;]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
| Pems | PemPress (from [[Queries/UniversalQ]]) |
| PemBefore | PemBefore (from [[Queries/UniversalQ]]) |
| STSCode | STSCode (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
If Left$(Initforms$, 2) = "14" Then
DocName = "Process Sheet Print 14"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
Else
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1"
End If
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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
Programmer.SetFocus
End Sub
Private Sub Button247_Click()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
' On Error GoTo button288_error
DoCmd.GoToRecord , , acNext
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
'Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
DoCmd.Hourglass True
Call diskout
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
If Checkupload = True Then
Call buttUpload_Click
End If
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
End Sub
Private Sub Command357_Click()
DoCmd.Hourglass True
Call UpdateGWs
DoCmd.Hourglass False
End Sub
Sub UpdateGWs()
Dim MainDB As Database, MainSet As Recordset
Dim Main2DB As Database, Main2Set As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
' currform.Refresh
PN$ = currform!PartNumber
PN$ = Left$(PN$, 7)
wh$ = currform!Warehouse
Set Main2Set = MainDB.OpenRecordset("RMSFILES#_MFWKP795", DB_OPEN_DYNASET) ' Create dynaset.
On Error Resume Next
Main2Set.MoveFirst
On Error GoTo 0
Users$ = Trim(myNTUserName$)
Do
If Not (Main2Set.EOF) Then
If Trim$(Main2Set![UID]) = Users$ Then
Main2Set.Delete
End If
DoEvents
Else
DoEvents
Exit Do
End If
Main2Set.MoveNext
Loop
Gws$ = Format(itsaNull$(currform!GrossWt), "#.000")
aws$ = Format(itsaNull$(currform!ActualWt), "#.000")
matl$ = currform!Field113.Column(2)
pps$ = currform!PartsPerSheet
If currform!PartsPerBlank.Visible = True Then
ppb$ = currform!PartsPerBlank
Else
ppb$ = currform!BlanksPerBlock
End If
Main2Set.AddNew
Main2Set![UID] = Users$
Main2Set!PRDNO = PN$
Main2Set!KBLWH = wh$
Main2Set!netwt = aws$
Main2Set!GRSwt = Gws$
Main2Set![MATL#] = matl$
Main2Set!SSIZE3 = pps$
Main2Set!BSIZE3 = ppb$
Main2Set.Update
Main2Set.Close
MainDB.Close
'ActiveXCtl358.CommandString = "Call PGM(MFR795) PARM('" + Users$ + "')"
'currform!ActiveXCtl358.DoClick
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
If Left$(Initforms$, 2) = "14" Then
DocName$ = "14" + Chr$(34) + " Process Sheet"
Else
DocName$ = "Process Sheet"
End If
PrimaryScreen$ = DocName$
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for what happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Filtered Parts"
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub Info_Click()
Call gatherinfo
Button246.SetFocus
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub PartNumber_GotFocus()
' If itsaNull(PartName) = "" Then
'Info.Visible = True
'Else
'Info.Visible = False
'End If
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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 Programmer_LostFocus()
A$ = Me![Programmer]
If A$ = "SG" Or A$ = "CB" Or A$ = "ST" Or A$ = "KL" Then
Checkupload = True
Else
Checkupload = False
End If
End Sub
Private Sub PunchDie_AfterUpdate()
If (PunchDie = "!NONE!") Or (Trim$(PunchDie) = "") Then
PunchPressOption.Visible = False
PunchCount.Visible = False
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
Sub gatherinfo()
Dim arrray$(100)
'Part$ = txtPartNumber 'hide when trying itsazero
'Min$ = LTrim(Left$(a$, 2))
Part1$ = Trim(Left$(PartNumber, 7))
Part2$ = Trim(Right$(PartNumber, 1))
Part$ = itsaNull(Part1$ + "." + Part2$)
If Exists("\\fryfs002v\ie1\sys\shoplink\vt2\" & Part$) Then
Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vt2\" & Part$)
PartName.Value = Cull2(arrray$(), "(PART NAME :", "0")
Reason.Value = Cull2(arrray(), "(JOB NUMBER :", "0")
End If
If Exists("\\fryfs002v\ie1\sys\shoplink\vlt1\" & Part$) Then
Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\vlt1\" & Part$)
PartName.Value = Cull(arrray$(), "(PART NAME :", "0")
Reason.Value = Cull(arrray(), "(JOB NUMBER :", "0")
End If
'If PartName = 0 Or itsaNull(PartName) = "" Then
'Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vt2\" & Part$)
'PartName.Value = Cull2(arrray$(), "(PART NAME :", "0")
'Reason.Value = Cull2(arrray(), "(JOB NUMBER :", "0")
'End If
'If PartName = 0 Or itsaNull(PartName) = "" Then
'Call loadCull(arrray$(), "\\fryfs002v\ie1\sys\shoplink\Vlt1\" & Part$)
'PartName.Value = Cull(arrray$(), "(PART NAME :", "0")
'Reason.Value = Cull(arrray(), "(JOB NUMBER :", "0")
'End If
'xxx$ = Cull(arrray$(), "FormWidth", "0")
'frmmain.Width = Val(xxx$)
End Sub
```
## What it does
**VBA Code Description**
=========================
This VBA code is designed to interact with an Access database. It appears to be part of a larger application, possibly a manufacturing or inventory management system.
**Button Click Event Handlers**
-----------------------------
The code contains several button click event handlers:
* `addPr_Click`: Sets the `NewPartName_Parm$` variable to "NEW" and calls the `AddPartButton` subroutine.
* `Button184_Click`: Calls the `Add_Additional_Process` subroutine without any parameters.
* `Button190_Click`: Quits the application when clicked. If an error occurs, displays an error message and resumes the quit process.
* `Button193_Click`: Sets the `NewPartName_Parm$` variable to the current part number and calls the `AddPartButton` subroutine.
* `Button194_Click`: Prints out a report without any parameters. If an error occurs, displays an error message and resumes the print process.
**Other Subroutines**
---------------------
The code contains several other subroutines:
* `search`: Searches for a part in the database based on the current form's primary key (part number). If the part is not found, it adds a new record to the "Machines" table with an unknown tool and part number.
* `HistoryR`: Calls the history report subroutine without any parameters.
* `Delete_Part`: Deletes a part from the database when called.
**Database Interactions**
-------------------------
The code interacts with the Access database in several ways:
* It opens various tables, such as "Process", "Machines", and "MachineNames".
* It performs CRUD (create, read, update, delete) operations on these tables.
* It uses error handling to catch and display any errors that occur during these interactions.
**Form Interactions**
-------------------
The code interacts with forms in several ways:
* It opens and closes various forms using the `DoCmd.OpenForm` and `DoCmd.Close` methods.
* It uses form-level variables, such as `Me!PartNumber`, to access part numbers and other form-specific data.
**Notes**
--------
* The code uses Access database objects, such as databases, tables, forms, and recordsets, which may require additional setup or configuration to work properly.
* Some of the variable names and subroutine names follow a consistent naming convention, while others do not. This inconsistency may make it difficult to understand the code without additional context.
**Improvement Suggestions**
---------------------------
* Consider refactoring the code to reduce duplication and improve maintainability.
* Use more descriptive variable names and subroutine names to make the code easier to understand.
* Add additional error handling or logging mechanisms to improve the application's reliability and debugging capabilities.

13
Forms/Tricks.md Normal file
View File

@ -0,0 +1,13 @@
# Tricks
Analysis generated on: 4/1/2025 4:11:39 PM
---
## Record Source
- [[Tables/Tricks]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field4 | TrickDescription (from [[Tables/Tricks]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

View File

@ -0,0 +1,67 @@
# Universal Selection Screen
Analysis generated on: 4/1/2025 4:04:39 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button2_Click()
Call ckPrimaryScreen
ErrM.Caption = ""
Mater$ = UnivREQName$ + "=" + Chr$(34) + itsaNull$(Answer) + Chr$(34)
If itsaNull$(Answer) <> "" Then
DoCmd.OpenForm PrimaryScreen$, , , Mater$
Else
ErrM.Caption = "Invalid " + UnivREQName$ + " Selected"
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
If Trim$(UnivREQName$) = "" Then
UnivREQName$ = "PartNumber"
End If
Header.Caption = "Select " + UnivREQName$
prompt.Caption = UnivREQName$ + ":"
End Sub
```
## What it does
**Code Description**
======================
### Overview
This VBA code snippet is part of an Access database application. It defines two event handlers: `Button2_Click` and `Form_Open`.
### Button2_Click Event Handler
The `Button2_Click` event handler is triggered when the button with identifier "Button2" is clicked.
**Step-by-Step Explanation**
1. **Check Primary Screen**: The code calls another subroutine, `ckPrimaryScreen`, which is not shown in this snippet. This suggests that it performs some preliminary checks or validation before proceeding.
2. **Clear Error Message**: An error message box (`ErrM`) is cleared by setting its caption to an empty string using the `Caption` property.
3. **Construct Form Parameter**: A parameter string (`Mater$`) is constructed by concatenating three values:
* `UnivREQName$`: a field in the database containing the required university or school name.
* `itsaNull$(Answer)`: an expression that evaluates to a boolean value, likely indicating whether the answer is null. The result is wrapped in single quotes (`''`) and then enclosed in single quotes again (e.g., `'yes'` or `''`). This suggests that the database expects the value to be returned as a string.
4. **Open Primary Screen Form**: If the `Answer` field is not empty (`itsaNull$(Answer) \u003c\u003e ""`), the code opens a form with identifier "PrimaryScreen" using `DoCmd.OpenForm`. The `Mater$` parameter is passed to this method, which likely uses it as part of the form's title or header.
5. **Invalid Answer Handling**: If the `Answer` field is empty (`itsaNull$(Answer) = ""`), an error message box with a custom caption ("Invalid " + `UnivREQName$` + " Selected") is displayed.
### Form_Open Event Handler
The `Form_Open` event handler is triggered when a form with identifier "Form" (or another identifying name, not shown in this snippet) is opened or loaded.
**Step-by-Step Explanation**
1. **Default Value**: If the `UnivREQName$` field is empty (`Trim$(UnivREQName$) = ""`), it defaults to a value of `"PartNumber"`.
2. **Form Header and Prompt**: The header caption of the form ("Header") is updated to reflect the current university or school name, which is stored in `UnivREQName$. The prompt text (`prompt`) is also updated to match the current university or school name.
In summary, this code snippet handles button click events and form opening events in an Access database application. It performs validation checks, constructs parameter strings for form operations, and updates form headers and prompts based on user input values.

View File

@ -0,0 +1,16 @@
# Update Work Centers
Analysis generated on: 4/1/2025 4:08:03 PM
---
## Record Source
- [[Queries/PBWCUpdateQuery]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Machine | Machine (from [[Queries/PBWCUpdateQuery]]) |
| WC2 | WC2 (from [[Queries/PBWCUpdateQuery]]) |
| WC3 | WC3 (from [[Queries/PBWCUpdateQuery]]) |
| WC4 | WC4 (from [[Queries/PBWCUpdateQuery]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

139
Forms/Util Adder.md Normal file
View File

@ -0,0 +1,139 @@
# Util Adder
Analysis generated on: 4/1/2025 4:04:28 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database
Private Sub cmdCreate_Click()
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util L X W") ' Create dynaset.
BGW! = BegWidth
EDW! = EndWidth
ICW! = IncWidth
BGL! = BegLength
EDL! = EndLength
ICL! = IncLength
For Sheet_Width! = BGW! To EDW! Step ICW!
For Sheet_Length! = BGL! To EDL! Step ICL!
MainSet.AddNew
MainSet!SheetL = Sheet_Length!
MainSet!sheetw = Sheet_Width!
MainSet.Update
Next
Next
End Sub
Private Sub cmdLengths_Click()
SheetWidths! = Val(AddWidths)
Call Addparms(2, SheetWidths!)
End Sub
Private Sub cmdWidths_Click()
SheetLength! = Val(AddLengths)
Call Addparms(1, SheetLength!)
End Sub
Private Sub Addparms(i%, Sizeses!)
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util L X W") ' Create dynaset.
BGW! = BegWidth
EDW! = EndWidth
ICW! = IncWidth
BGL! = BegLength
EDL! = EndLength
ICL! = IncLength
If i% = 1 Then
BG! = BegWidth
ed! = EndWidth
IC! = IncWidth
Else
BG! = BegLength
ed! = EndLength
IC! = IncLength
End If
For SS! = BG! To ed! Step IC!
If i% = 1 Then
SheetWidth! = SS!
SheetLength! = Sizeses!
Else
SheetWidth! = Sizeses!
SheetLength! = SS!
End If
MainSet.AddNew
MainSet!SheetL = SheetLength!
MainSet!sheetw = SheetWidth!
MainSet.Update
Next
End Sub
```
## What it does
**VBA Code Description**
=========================
This VBA code is written in an Access database and appears to be part of a larger application for managing sheet sizes. The code consists of three main subroutines: `cmdCreate`, `cmdLengths`, and `cmdWidths`.
### cmdCreate_Click Subroutine
**Purpose:** Create new records in the "Util L X W" dynaset with specified sheet widths and lengths.
**Description:**
1. Opens the database and creates a dynamic recordset named "Util L X W".
2. Sets various global variables (`BGW!`, `EDW!`, `ICW!`, `BGL!`, `EDL!`, and `ICL!`) to define the range of sheet widths, lengths, and incremental values.
3. Loops through all possible combinations of sheet widths (from `BGW!` to `EDW!` with an increment of `ICW!`) and lengths (from `BGL!` to `EDL!` with an increment of `ICL!`).
4. For each combination, creates a new record in the dynamic recordset with the corresponding sheet width and length.
5. Updates the dynaset to reflect the changes.
### cmdLengths_Click Subroutine
**Purpose:** Update global variables for sheet lengths based on user input.
**Description:**
1. Sets the global variable `SheetWidths!` to the value of the "Add Widths" field.
2. Calls the `Addparms` subroutine with `i% = 2` and `SheetWidths!` as arguments.
3. This sets up the dynaset for sheet widths.
### cmdWidths_Click Subroutine
**Purpose:** Update global variables for sheet lengths based on user input.
**Description:**
1. Sets the global variable `SheetLength!` to the value of the "Add Lengths" field.
2. Calls the `Addparms` subroutine with `i% = 1` and `SheetLength!` as arguments.
3. This sets up the dynaset for sheet lengths.
### Addparms Subroutine
**Purpose:** Updates global variables for sheet dimensions based on user input and dynaset configuration.
**Description:**
1. Opens the database and creates a dynamic recordset named "Util L X W".
2. Sets various global variables (`BG!`, `ed!`, and `IC!`) to define the range of sheet widths, lengths, and incremental values based on the value of `i%`.
3. Loops through all possible combinations of sheet widths (from `BG!` to `ed!` with an increment of `IC!`) and lengths (from `BGL!` to `EDL!` with an increment of `ICL!`).
4. For each combination, sets the global variables `SheetWidths!` and `SheetLength!` accordingly.
5. Updates the dynaset to reflect the changes.
Note: The code uses global variables (`BGW!`, `EDW!`, `ICW!`, `BGL!`, `EDL!`, `ICL!`, etc.) which may not be suitable for large-scale applications or production environments.

View File

@ -0,0 +1,18 @@
# Util L X W subform
Analysis generated on: 4/1/2025 4:09:19 PM
---
## Record Source
- [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| IDNo | IDNo (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
| SheetW | SheetW (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
| SheetL | SheetL (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
| GrossWeight | GrossWeight (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
| ErrCount | ErrCount (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
| TotalPrice | TotalPrice (from [[Tables/SELECT DISTINCTROW [Util L X W].IDNo, [Util L X W].SheetW, [Util L X W].SheetL, [Util L X W].GrossWeight, [Util L X W].ErrCount, [Util L X W].TotalPrice FROM [Util L X W];]]) |
## VBA Code
*None*
## What it does
*No VBA code to document*

115
Forms/Util Result1.md Normal file
View File

@ -0,0 +1,115 @@
# Util Result1
Analysis generated on: 4/1/2025 4:03:04 PM
---
## Record Source
- [[Tables/Util Selection C1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| ACTIV | ACTIV (from [[Tables/Util Selection C1]]) |
| PHANT | PHANT (from [[Tables/Util Selection C1]]) |
| MAKE# | MAKE# (from [[Tables/Util Selection C1]]) |
| ITTYP | ITTYP (from [[Tables/Util Selection C1]]) |
| USAGE | USAGE (from [[Tables/Util Selection C1]]) |
| PMNAS | PMNAS (from [[Tables/Util Selection C1]]) |
| WOQTY | WOQTY (from [[Tables/Util Selection C1]]) |
| BSIZE2 | BSIZE2 (from [[Tables/Util Selection C1]]) |
| PartNumber | PartNumber (from [[Tables/Util Selection C1]]) |
| Flag | Flag (from [[Tables/Util Selection C1]]) |
| PartName | PartName (from [[Tables/Util Selection C1]]) |
| CutType | CutType (from [[Tables/Util Selection C1]]) |
| PunchOption | PunchOption (from [[Tables/Util Selection C1]]) |
| PunchNumber | PunchNumber (from [[Tables/Util Selection C1]]) |
| PunchPartsPerStrip | PunchPartsPerStrip (from [[Tables/Util Selection C1]]) |
| PunchStd | PunchStd (from [[Tables/Util Selection C1]]) |
| GrainDir | GrainDir (from [[Tables/Util Selection C1]]) |
| GrainNone | GrainNone (from [[Tables/Util Selection C1]]) |
| FirstDim | FirstDim (from [[Tables/Util Selection C1]]) |
| SecDim | SecDim (from [[Tables/Util Selection C1]]) |
| PartsPerBlank | PartsPerBlank (from [[Tables/Util Selection C1]]) |
| PartsPerSheet | PartsPerSheet (from [[Tables/Util Selection C1]]) |
| BlocksPerSheet | BlocksPerSheet (from [[Tables/Util Selection C1]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Tables/Util Selection C1]]) |
| PartHeight | PartHeight (from [[Tables/Util Selection C1]]) |
| PartWidth | PartWidth (from [[Tables/Util Selection C1]]) |
| BotTrimCut | BotTrimCut (from [[Tables/Util Selection C1]]) |
| TopTrimCut | TopTrimCut (from [[Tables/Util Selection C1]]) |
| ActualPartHeight | ActualPartHeight (from [[Tables/Util Selection C1]]) |
| ActualPartWidth | ActualPartWidth (from [[Tables/Util Selection C1]]) |
| PartSize | PartSize (from [[Tables/Util Selection C1]]) |
| GrossWt | GrossWt (from [[Tables/Util Selection C1]]) |
| ActualWt | ActualWt (from [[Tables/Util Selection C1]]) |
| Utilization | Utilization (from [[Tables/Util Selection C1]]) |
| SheetSize | SheetSize (from [[Tables/Util Selection C1]]) |
| CalculationStatus | CalculationStatus (from [[Tables/Util Selection C1]]) |
| Field113 | MetalType (from [[Tables/Util Selection C1]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| BestSheetSet | BestSheetSet (from [[Tables/Util Selection C1]]) |
| HOUSE | HOUSE (from [[Tables/Util Selection C1]]) |
## VBA Code
```vba
Option Compare Database
Option Explicit
Private Sub Command120_Click()
On Error GoTo Err_Command120_Click
DoCmd.GoToRecord , , acNext
Exit_Command120_Click:
Exit Sub
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
End Sub
```
## What it does
**Code Description**
====================
### Overview
The provided VBA code is a subroutine named `Command120_Click` which appears to be part of an Access database application. This code snippet handles the click event of a button with the command ID 120.
### Code Breakdown
-------------------
#### Option Declarations
* `Option Compare Database`: This line tells Visual Basic that strings should be compared using the database comparison rules, ensuring that uppercase and lowercase letters are treated as equal.
* `Option Explicit`: This option forces all variable declarations to be explicit. In other words, it ensures that variables declared within a subroutine or module must have their data type specified.
#### Subroutine Definition
```markdown
Private Sub Command120_Click()
```
This line defines the `Command120_Click` subroutine, which is triggered when the button with command ID 120 is clicked.
#### Error Handling
* `On Error GoTo Err_Command120_Click`: This statement sets up error handling by specifying that if an error occurs in the code within this subroutine (between `Private Sub Command120_Click()` and the first `Exit` statement), it should jump to the label marked as `Err_Command120_Click`.
* `DoCmd.GoToRecord , , acNext`: If no errors occur, this line executes the `GoToRecord` method of the `DoCmd` object. The `acNext` constant specifies that after navigating to a record, Access should proceed to navigate to the next record.
#### Error Handling Resume
```markdown
Exit_Command120_Click:
Exit Sub
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
```
* `Exit_Command120_Click`: This label marks the end of the subroutine if there are no errors. The `Exit Sub` statement terminates the execution of the subroutine.
* `Err_Command120_Click`: If an error does occur, this label is executed instead. It displays a message box containing the description of the error using `MsgBox Err.Description`. After displaying the error message, it resumes execution at the `Exit_Command120_Click` label, effectively retrying the failed operation.
### Best Practices
* The code makes use of robust error handling to provide useful feedback in case something goes wrong.
* It adheres to explicit variable declarations and follows Access-specific command IDs for button commands.

134
Forms/Util Result2.md Normal file
View File

@ -0,0 +1,134 @@
# Util Result2
Analysis generated on: 4/1/2025 4:04:12 PM
---
## Record Source
- [[Tables/Util Selection C1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| ACTIV | ACTIV (from [[Tables/Util Selection C1]]) |
| PHANT | PHANT (from [[Tables/Util Selection C1]]) |
| MAKE# | MAKE# (from [[Tables/Util Selection C1]]) |
| ITTYP | ITTYP (from [[Tables/Util Selection C1]]) |
| USAGE | USAGE (from [[Tables/Util Selection C1]]) |
| PMNAS | PMNAS (from [[Tables/Util Selection C1]]) |
| WOQTY | WOQTY (from [[Tables/Util Selection C1]]) |
| BSIZE2 | BSIZE2 (from [[Tables/Util Selection C1]]) |
| PartNumber | PartNumber (from [[Tables/Util Selection C1]]) |
| Flag | Flag (from [[Tables/Util Selection C1]]) |
| PartName | PartName (from [[Tables/Util Selection C1]]) |
| CutType | CutType (from [[Tables/Util Selection C1]]) |
| PunchOption | PunchOption (from [[Tables/Util Selection C1]]) |
| PunchNumber | PunchNumber (from [[Tables/Util Selection C1]]) |
| PunchPartsPerStrip | PunchPartsPerStrip (from [[Tables/Util Selection C1]]) |
| PunchStd | PunchStd (from [[Tables/Util Selection C1]]) |
| GrainDir | GrainDir (from [[Tables/Util Selection C1]]) |
| GrainNone | GrainNone (from [[Tables/Util Selection C1]]) |
| FirstDim | FirstDim (from [[Tables/Util Selection C1]]) |
| SecDim | SecDim (from [[Tables/Util Selection C1]]) |
| PartsPerBlank | PartsPerBlank (from [[Tables/Util Selection C1]]) |
| PartsPerSheet | PartsPerSheet (from [[Tables/Util Selection C1]]) |
| BlocksPerSheet | BlocksPerSheet (from [[Tables/Util Selection C1]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Tables/Util Selection C1]]) |
| PartHeight | PartHeight (from [[Tables/Util Selection C1]]) |
| PartWidth | PartWidth (from [[Tables/Util Selection C1]]) |
| BotTrimCut | BotTrimCut (from [[Tables/Util Selection C1]]) |
| TopTrimCut | TopTrimCut (from [[Tables/Util Selection C1]]) |
| ActualPartHeight | ActualPartHeight (from [[Tables/Util Selection C1]]) |
| ActualPartWidth | ActualPartWidth (from [[Tables/Util Selection C1]]) |
| PartSize | PartSize (from [[Tables/Util Selection C1]]) |
| GrossWt | GrossWt (from [[Tables/Util Selection C1]]) |
| ActualWt | ActualWt (from [[Tables/Util Selection C1]]) |
| Utilization | Utilization (from [[Tables/Util Selection C1]]) |
| SheetSize | SheetSize (from [[Tables/Util Selection C1]]) |
| CalculationStatus | CalculationStatus (from [[Tables/Util Selection C1]]) |
| Field113 | MetalType (from [[Tables/Util Selection C1]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| BestSheetSet | BestSheetSet (from [[Tables/Util Selection C1]]) |
| MachineName | MachineName (from [[Tables/Util Selection C1]]) |
## VBA Code
```vba
Option Compare Database
Option Explicit
Private Sub Command120_Click()
On Error GoTo Err_Command120_Click
DoCmd.GoToRecord , , acNext
Exit_Command120_Click:
Exit Sub
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
End Sub
```
## What it does
**Command120 Click Event Handler**
=====================================
### Overview
This is a VBA code module that handles the click event of a command button with ID 120. When the button is clicked, it performs the following actions:
### Code Breakdown
#### Option Statements
The code begins with two `Option` statements:
* `Option Compare Database`: This statement specifies that string comparisons in this code module should be performed as if they were case-insensitive when comparing database strings.
* `Option Explicit`: This statement requires that all variables declared within the code must be explicitly initialized or passed to a procedure.
#### Command120 Click Event Handler
The `Private Sub` declaration defines a new subroutine called `Command120_Click`. When this button is clicked, this event handler will be invoked:
```vb
Private Sub Command120_Click()
```
#### On Error Handling
The next statement sets up error handling for the code within the `Command120_Click` subroutine. If an error occurs while executing this subroutine, it will jump to the designated error-handling label and display the error message:
```vb
On Error GoTo Err_Command120_Click
```
#### Moving to Next Record
Inside the `Command120_Click` event handler, there is a call to the `DoCmd.GoToRecord` method, which moves the current record in the active database table to the next record. This action assumes that the records are ordered by their primary key or some other unique identifier.
```vb
DoCmd.GoToRecord , , acNext
```
#### Exit Event Handler
After moving to the next record, the code exits the `Command120_Click` subroutine:
```vb
Exit_Command120_Click:
Exit Sub
```
#### Error Handling Resume
If an error occurs within the `Command120_Click` event handler while executing this code block, it will display the error description using a message box and resume execution from the next statement after the `Err_Command120_Click` label:
```vb
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
```
### Notes
* This code assumes that the `Command120` button is in an Access database, and it has a specific ID of 120.
* The `DoCmd.GoToRecord` method moves to the next record based on its primary key or other unique identifier.
This event handler provides basic functionality for navigating through records within a database table when the specified button is clicked.

View File

@ -0,0 +1,62 @@
# Util Select picker
Analysis generated on: 4/1/2025 4:03:39 PM
---
## Record Source
- [[Queries/Util Select 0 Q1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Queries/Util Select 0 Q1]]) |
| Flag | Flag (from [[Queries/Util Select 0 Q1]]) |
## VBA Code
```vba
Option Compare Database
Private Sub cmdFindPart_Click()
On Error GoTo Err_cmdFindPart_Click
s$ = txtSearch
PartNumber.SetFocus
DoCmd.FindRecord s$, acAnywhere, False, , True
Flag = "1"
txtSearch.SetFocus
Exit_cmdFindPart_Click:
Exit Sub
Err_cmdFindPart_Click:
MsgBox Err.Description
Resume Exit_cmdFindPart_Click
End Sub
```
## What it does
**VBA Code Description: Find Record Command**
### Overview
This VBA code snippet is used to execute a "Find Record" command in an Access database application. It allows users to search for specific records based on user input and provides feedback through error handling and automatic focus shifting.
### Step-by-Step Explanation
1. **Option Compare Database**: This line specifies that the comparison of strings should be case-insensitive, which is useful when searching for partial matches.
2. **Private Sub cmdFindPart_Click()**: This declares a private subroutine named `cmdFindPart_Click`, which will be triggered when a command button with the label "Find Part" is clicked.
3. **On Error GoTo Err_cmdFindPart_Click**: This line sets up error handling, specifying that if an error occurs within the subroutine, control should jump to the labeled block of code (`Err_cmdFindPart_Click`).
4. **s$ = txtSearch**: Retrieves the text from a search input field (`txtSearch`) and stores it in the variable `s$`.
5. **PartNumber.SetFocus**: Automatically focuses on a form or control named "PartNumber".
6. **DoCmd.FindRecord s$, acAnywhere, False, , True**: This line performs a find record operation in the current database table, searching for records that match the input string (`s$`) anywhere in the fields. The `acAnywhere` parameter indicates that the search should be performed anywhere in the field values. The other parameters (`False`, `, , True`) specify additional options, such as ignoring case and performing an exact match.
7. **Flag = "1"**: Sets a variable named `Flag` to the value `"1"`. This variable can be used elsewhere in the code to indicate that the find record operation was successful.
8. **txtSearch.SetFocus**: Automatically focuses on the search input field (`txtSearch`) after the find record operation completes.
9. **Exit_cmdFindPart_Click**: Exits the subroutine, allowing the program to continue executing.
### Error Handling Block
1. **Err_cmdFindPart_Click**: If an error occurs within the subroutine (i.e., `On Error GoTo Err_cmdFindPart_Click`), this labeled block of code is executed.
2. **MsgBox Err.Description**: Displays an error message box with a description of the error, retrieved from the `Err.Description` property.
3. **Resume Exit_cmdFindPart_Click**: Resumes execution at the next line of code after the error handling block, specifically the `Exit_cmdFindPart_Click` label.
### Best Practices and Security Considerations
* This code assumes that the search input field (`txtSearch`) is a text control, and the "PartNumber" form or control is also accessible within the application.
* The use of `On Error GoTo Err_cmdFindPart_Click` and `Resume Exit_cmdFindPart_Click` provides basic error handling, but may not be sufficient for all error scenarios. Additional error handling techniques, such as try-catch blocks, should be considered in more complex applications.
* The code does not perform any input validation or sanitization on the user-provided search string. This could potentially lead to security issues or unexpected behavior if malicious data is entered into the search field.

53
Forms/Utilities.md Normal file
View File

@ -0,0 +1,53 @@
# Utilities
Analysis generated on: 4/1/2025 4:03:12 PM
---
## Record Source
- [[Tables/Process]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| PartNumber | PartNumber (from [[Tables/Process]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button3_Click()
AppActivate "SessionA - [24 x 80]"
SendKeys "1{ENTER}"
End Sub
```
## What it does
**Code Description**
======================
### Overview
This VBA code snippet is a subroutine that triggers an action when a button labeled "Button3" is clicked. The code's purpose is to activate a specific window and send a key press sequence to it.
### Breakdown
#### Option Compare Database
The first line, `Option Compare Database`, sets the comparison order for string comparisons to use database sorting. This setting affects how VBA compares strings when performing operations like matching or searching.
#### Button3_Click Subroutine
The code defines a private subroutine named `Button3_Click`. This subroutine is triggered when the button labeled "Button3" is clicked.
* The first line, `AppActivate "SessionA - [24 x 80]"`, activates the window with the specified title. The title contains a screen resolution reference (`[24 x 80]`) followed by the main application name (`SessionA`). This suggests that the code is intended for use in an environment where multiple applications are running simultaneously, and the user needs to focus on a specific one.
* The second line, `SendKeys "1{ENTER}"`, sends a key press sequence to the currently active window. In this case, it simulates pressing the number 1 followed by the Enter key.
### Functionality
When the button labeled "Button3" is clicked, this code:
1. Activates the specified window with the title `SessionA - [24 x 80]`.
2. Sends a key press sequence to the active window, simulating the press of the number 1 followed by the Enter key.
### Assumptions and Context
The presence of the screen resolution reference (`[24 x 80]`) in the title suggests that this code is designed for use with an application or environment that displays multiple windows with different resolutions. The use of `AppActivate` and `SendKeys` implies that the code is running in a graphical user interface (GUI) environment, likely Microsoft Excel or another office software.
Without more context, it's difficult to provide specific guidance on how to modify or extend this code. However, this description should give you a clear understanding of what the code does and how it functions.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

101
Forms/YESORNO.md Normal file
View File

@ -0,0 +1,101 @@
# YESORNO
Analysis generated on: 4/1/2025 4:00:54 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Private Sub Button0_Click()
YESORNO% = 1
End Sub
Private Sub Button1_Click()
YESORNO% = 2
End Sub
Private Sub Form_Load()
YESORNO% = 0
Text3.Caption = "Are you sure you wanted to " + YesOrNoStr$ + "?"
End Sub
```
## What it does
**VBA Code Description**
========================
### Overview
This VBA code snippet is written in a Microsoft Excel add-in, likely used for creating custom buttons and forms. It defines three event handlers: `Button0_Click`, `Button1_Click`, and `Form_Load`. These handlers manipulate the value of a global variable `YESORNO` and update UI elements accordingly.
### Global Variable and Initialization
The code uses a global variable `YESORNO` to store integer values (1, 2, or 0). The initialization of this variable is defined in the `Form_Load` event handler. In this handler:
* `YESORNO` is set to 0.
* The text of a UI element named `Text3` is updated using the `YesOrNoStr$` function.
### Button Click Events
The code defines two button click events: `Button0_Click` and `Button1_Click`. These handlers update the value of `YESORNO` to 1 and 2, respectively. The changes occur without any visible side effects or additional actions.
### Event Handler Functions
Although not explicitly shown in this snippet, the following functions are likely used to convert integer values to string representations:
* `YesOrNoStr$`: Converts an integer value (0, 1, or 2) to a human-readable string. The exact implementation is not provided in this code.
### Best Practices
The use of global variables and event handlers raises some concerns about code organization and maintainability. A more modular approach would consider encapsulating the `YESORNO` variable within a class or module for better control and reusability. Additionally, using named constants instead of magic numbers (e.g., 1 and 2) could improve code readability.
### Code Snippet Example
Here is the provided code snippet with Markdown formatting:
```markdown
# VBA Code Description
## Overview
This VBA code snippet is written in a Microsoft Excel add-in, likely used for creating custom buttons and forms. It defines three event handlers: `Button0_Click`, `Button1_Click`, and `Form_Load`. These handlers manipulate the value of a global variable `YESORNO` and update UI elements accordingly.
## Global Variable and Initialization
### Initialization in Form Load Event Handler
```vba
Private Sub Form_Load()
YESORNO% = 0
Text3.Caption = "Are you sure you wanted to " + YesOrNoStr$ + "?"
End Sub
```
The code uses a global variable `YESORNO` to store integer values (1, 2, or 0). The initialization of this variable is defined in the `Form_Load` event handler. In this handler:
* `YESORNO` is set to 0.
* The text of a UI element named `Text3` is updated using the `YesOrNoStr$` function.
### Button Click Events
### Button0_Click Event Handler
```vba
Private Sub Button0_Click()
YESORNO% = 1
End Sub
```
This handler updates the value of `YESORNO` to 1.
### Button1_Click Event Handler
```vba
Private Sub Button1_Click()
YESORNO% = 2
End Sub
```
This handler updates the value of `YESORNO` to 2.
```
Please note that I did not actually implement YesOrNoStr as it was not defined in your prompt.

View File

@ -0,0 +1,13 @@
# frmOllamaProgress
Analysis generated on: 4/1/2025 4:11:49 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| *None* | - |
## VBA Code
*None*
## What it does
*No VBA code to document*

715
Forms/temp.md Normal file
View File

@ -0,0 +1,715 @@
# temp
Analysis generated on: 4/1/2025 4:06:31 PM
---
## Record Source
- [[Queries/UniversalQ]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Field113 | MetalType (from [[Queries/UniversalQ]]) |
| Field113 (Row Source) | [[Tables/[metalQ1];]] |
| DatasheetFlag (Row Source) | |
| Field325 | Warehouse (from [[Queries/UniversalQ]]) |
| Field325 (Row Source) | |
| BlankSize | BlankSize (from [[Queries/UniversalQ]]) |
| PartSize | PartSize (from [[Queries/UniversalQ]]) |
| GrossWt | GrossWt (from [[Queries/UniversalQ]]) |
| ActualWt | ActualWt (from [[Queries/UniversalQ]]) |
| Utilization | Utilization (from [[Queries/UniversalQ]]) |
| SheetSize | SheetSize (from [[Queries/UniversalQ]]) |
| GrainDir | GrainDir (from [[Queries/UniversalQ]]) |
| GrainDir (Row Source) | |
| BlocksPerSheet | BlocksPerSheet (from [[Queries/UniversalQ]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Queries/UniversalQ]]) |
| PartsPerSheet | PartsPerSheet (from [[Queries/UniversalQ]]) |
| ActualPartHeight | ActualPartHeight (from [[Queries/UniversalQ]]) |
| PartCost | PartCost (from [[Queries/UniversalQ]]) |
| Field238 | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PartNumber | PartNumber (from [[Queries/UniversalQ]]) |
| PartName | PartName (from [[Queries/UniversalQ]]) |
| IssueNumber | IssueNumber (from [[Queries/UniversalQ]]) |
| IssueDate | IssueDate (from [[Queries/UniversalQ]]) |
| PreviousIssue | PreviousIssue (from [[Queries/UniversalQ]]) |
| PreviousDate | PreviousDate (from [[Queries/UniversalQ]]) |
| Programmer | Programmer (from [[Queries/UniversalQ]]) |
| PrintSize | PrintSize (from [[Queries/UniversalQ]]) |
| History | History (from [[Queries/UniversalQ]]) |
| MetalType | MetalType (from [[Queries/UniversalQ]]) |
| MetalType (Row Source) | [[Tables/[metalQ1];]] |
| FirstDim | FirstDim (from [[Queries/UniversalQ]]) |
| SecDim | SecDim (from [[Queries/UniversalQ]]) |
| BotTrimCut | BotTrimCut (from [[Queries/UniversalQ]]) |
| TopTrimCut | TopTrimCut (from [[Queries/UniversalQ]]) |
| CutType | CutType (from [[Queries/UniversalQ]]) |
| CutType (Row Source) | |
| Deburr | Deburr (from [[Queries/UniversalQ]]) |
| Deburr (Row Source) | |
| PartWidth | PartWidth (from [[Queries/UniversalQ]]) |
| ActualPartWidth | ActualPartWidth (from [[Queries/UniversalQ]]) |
| PartsPerBlank | PartsPerBlank (from [[Queries/UniversalQ]]) |
| PressBrake | PressBrake (from [[Queries/UniversalQ]]) |
| PressBrake (Row Source) | |
| EntPartHeight | PartHeight (from [[Queries/UniversalQ]]) |
| Field240 | CellDeburrTypes (from [[Queries/UniversalQ]]) |
| Field240 (Row Source) | |
| SavedProcesses (Row Source) | [[Tables/[QWorkCenters];]] |
| AddnlDeburrInches | AddnlDeburrInches (from [[Queries/UniversalQ]]) |
| Reason | Reason (from [[Queries/UniversalQ]]) |
| PunchPressOption | PunchOption (from [[Queries/UniversalQ]]) |
| PunchCount | PunchPartsPerStrip (from [[Queries/UniversalQ]]) |
| PunchDie | PunchNumber (from [[Queries/UniversalQ]]) |
| PunchDie (Row Source) | [[Tables/punchpressQ1;]] |
| GrainShearChk | GrainShear (from [[Queries/UniversalQ]]) |
| PunchStd | PunchStd (from [[Queries/UniversalQ]]) |
| PhantomNumber | PhantomNumber (from [[Queries/UniversalQ]]) |
| Gr3 | GrainNone (from [[Queries/UniversalQ]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Queries/UniversalQ]]) |
| Pems | PemPress (from [[Queries/UniversalQ]]) |
| PemBefore | PemBefore (from [[Queries/UniversalQ]]) |
## VBA Code
```vba
Option Compare Database 'Use database order for string comparisons
Dim dwncntL%, dwncntT%, dwncnt%, ToyClick%, ToyCaption%, Toys$(10)
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
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
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.
' Set MachNamesSet = StMachNamesSet
' Set MachQSet = StMachQSet
' Set MainSet = StMainSet
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()
Dim DocName As String
DocName = "YESORNO"
YesOrNoStr$ = "delete this part"
DoCmd.OpenForm DocName
Do Until YESORNO% > 0
DoEvents
Loop
DoCmd.Close A_FORM, DocName
If YESORNO% <> 1 Then
Exit Sub
End If
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 Button288_Click()
PN$ = currform![PartNumber]
thispn$ = " "
' DoCmd GoToRecord , , A_FIRST
Do
Call Calculate_Button
On Error GoTo button288_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button288_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button288_error:
Resume button288_last
End Sub
Private Sub Button289_Click()
End Sub
Private Sub Button290_Click()
PN$ = currform![PartNumber]
thispn$ = " "
DoCmd.GoToRecord , , A_FIRST
Do
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PRINTALL, "Q1-14" + Chr$(34)
On Error GoTo button290_error
DoCmd.GoToRecord , , A_NEXT
On Error GoTo 0
nextpn$ = currform![PartNumber]
If thispn$ = nextpn$ Then
Exit Do
End If
thispn$ = nextpn$
Loop
button290_last:
Call GOTOPARTNUMBER(PN$, PrimaryScreen$)
Call Button291_Click
Exit Sub
button290_error:
Resume button290_last
End Sub
Private Sub Button291_Click()
If Button291.Width = Int(0.5563 * 1440) Then
Button291.Left = 0.0521 * 1440
Button291.Width = 1.7021 * 1440
Button291.Caption = "DO ALL"
Else
Button291.Left = 1.1979 * 1440
Button291.Width = 0.5563 * 1440
Button291.Caption = "Do All Saftey"
End If
End Sub
Private Sub Button294_Click()
PN$ = currform!PartNumber
Phn$ = itsaNull$(currform!PhantomNumber)
If PN$ <> Phn$ Then
If Phn$ <> "" Then
Call GOTOPARTNUMBER(Phn$, PrimaryScreen$)
End If
End If
End Sub
Private Sub Button309_Click()
On Error GoTo Err_Button309_Click
If currform![CalculationStatus] <> 0 Then
M$ = "Unable to Print Report." + Chr$(13) + "Calculation Status Of Part in Error."
MsgBox M$
Exit Sub
End If
Refresh
DocName = "Process Sheet Print"
DoCmd.OpenReport DocName, A_PREVIEW, "Q1-14" + Chr$(34)
Exit_Button309_Click:
Exit Sub
Err_Button309_Click:
MsgBox Error$
Resume Exit_Button309_Click
End Sub
Private Sub Button322_Click()
DoCmd.Hourglass True
Call diskout
DoCmd.Hourglass False
End Sub
Private Sub Button324_Click()
'add a data sheet for Eugene!!!
End Sub
Private Sub Button327_Click()
DoCmd.Hourglass True
p$ = currform.PartNumber
If PaperLaserFlag Then PaperFlag$ = "1" Else PaperFlag$ = "0"
Call LaserTapeGenerate(p$, PaperFlag$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub buttUpload_Click()
On Error GoTo Err_buttUpload_Click
Dim x As Integer
Dim AppName As String
AppName = "S:\UPLOADER.BAT"
x = Shell(AppName, 1)
Exit_buttUpload_Click:
Exit Sub
Err_buttUpload_Click:
MsgBox Error$
Resume Exit_buttUpload_Click
End Sub
Private Sub CalcCNCtape_Click()
DoCmd.Hourglass True
Call Button200_Click
p$ = currform.PartNumber
Call CalcCNCRunTimes(p$)
DoCmd.Hourglass False
Refresh
End Sub
Private Sub Calculate_Click()
Dim DocName As String
Call Calculate_Button
End Sub
Private Sub cmdTricks_Click()
On Error GoTo Err_cmdTricks_Click
Dim DocName As String
Dim LinkCriteria As String
DocName = "Tricks"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_cmdTricks_Click:
Exit Sub
Err_cmdTricks_Click:
MsgBox Error$
Resume Exit_cmdTricks_Click
End Sub
Private Sub Command357_Click()
DoCmd.Hourglass True
Call UpdateAS400
DoCmd.Hourglass False
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$ = itsaNull$(Me!IssueNumber)
If A$ = "" Then A$ = " "
l = 0
On Error GoTo BadRecord
Me!IssueNumber = A$
If l <> 0 Then
LockedRecord.Visible = True
Else
LockedRecord.Visible = False
End If
On Error GoTo 0
Call CutTypeFormSettings
Call PBFormView
Call PemPressView
GrainFromRec
Call ErrorMessages
Exit Sub
BadRecord:
l = 1
Resume Next
End Sub
Private Sub Form_Load()
Set currform = Me
On Error GoTo FL_die
dwncntT% = 1
dwncntL% = 1
TextCalcErr.Visible = False
TextCalcErr.Top = 2.58 * 1440
PrimaryScreen$ = "14" + Chr$(34) + " Process Sheet"
On Error GoTo FL_die
DoCmd.GoToControl "PartName"
DoCmd.GoToControl "PartNumber"
On Error GoTo 0
ToyDepartment:
On Error Resume Next
Toys$(0) = "DO NOT PRESS THIS BUTTON"
Toys$(1) = "HEY, I told you not to do that!"
Toys$(2) = "What Kinda Moron are you?"
Toys$(3) = "I'm Warning you...."
Toys$(4) = "If you think this is a joke..."
Toys$(5) = "OK, Look... if you do that again..."
Toys$(6) = "What's a matter buddy can't you read?"
Toys$(7) = "I won't be held responsible for happens next!"
Toys$(8) = "If you do that again... You Will Be sorry!"
Toys$(9) = "I tried to warn you!"
Toys$(10) = "That was fun but . . . DO NOT PRESS THIS BUTTON"
Killer.Top = 0
Killer.Left = 0
Killer.Height = 9285
Killer.Width = 10785
Exit Sub
FL_die:
If Err = 2109 Then
End
End If
Resume Next
End Sub
Private Sub Form_Timer()
If dwncnt% = 1 Then
Steps% = 100
Toy.Visible = True
Toy.Top = Toy.Top + dwncntT% * Steps%
Toy.Left = Toy.Left + dwncntL% * Steps%
If ((Toy.Top + dwncntT% * Steps%) > 7000) Then
dwncntT% = -1
Toy.Top = 7000
End If
If ((Toy.Top + dwncntT% * Steps%) < 0) Then
Toy.Top = 0
dwncntT% = 1
End If
If ((Toy.Left + dwncntL% * Steps%) > 7000) Then
Toy.Left = 7000
dwncntL% = -1
End If
If ((Toy.Left + dwncntL% * Steps%) < 0) Then
Toy.Left = 0
dwncntL% = 1
End If
End If
If ToyClick% = 1 Then
ToyClick% = 0
ToyCaption% = ToyCaption% + 1
If ToyCaption% > 10 Then
ToyCaption% = 0
dwncnt% = 0
Toy.FontSize = 8
Toy.Height = 840
Toy.Width = 870
Toy.Top = 945
Toy.Left = 9465
End If
If ToyCaption% = 9 Then
Killer.Visible = True
Else
Killer.Visible = False
End If
Toy.Caption = Toys$(ToyCaption%)
End If
End Sub
Private Sub GrainShearChk_Click()
Call CutTypeFormSettings
End Sub
Private Sub GrDirOpt_Click()
NewGrain
End Sub
Private Sub MetalType_Click()
Call CutTypeFormSettings
End Sub
Private Sub Pems_AfterUpdate()
Call PemPressView
End Sub
Private Sub PressBrake_Click()
Call PBFormView
End Sub
Private Sub PressBrake_GotFocus()
Call PBFormView
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
PunchStd.Visible = False
Else
PunchPressOption.Visible = True
If CutType = "Single" Then
PunchCount.Visible = False
PunchStd.Visible = True
Else
PunchCount.Visible = True
PunchStd.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 = True
End If
Else
PunchCount.Visible = False
End If
PunchStd.Visible = True
End Sub
Private Sub Toy_Click()
If ToyCaption% = 0 Then
Toy.FontSize = 18
Toy.Height = 1305
Toy.Width = 3570
dwncnt% = 1
End If
ToyClick% = 1
End Sub
```
## What it does
# VBA Code Description
========================
This VBA code is designed for an Access database application, likely a machine shop management system. It contains various event handlers that control the behavior of different buttons and forms in the application.
## Button 184: Add Additional Process
------------------------------------
* When this button is clicked, it calls the `Add_Additional_Process` subroutine without any parameters.
* The code is wrapped in an error handler (`Err_Button190_Click`) to catch any exceptions that may occur during execution.
## Button 193: Add Part Button
------------------------------
* This button calls the `AddPartButton` subroutine when clicked.
* It retrieves the value of the `NewPartName_Parm$` variable, which is set to "NEW" by the `addPr_Click` event handler.
* The code is also wrapped in an error handler (`Err_Button194_Click`) to catch any exceptions that may occur during execution.
## Button 196: Print Report
-------------------------
* When this button is clicked, it checks if the calculation status of the part is valid (i.e., not equal to 0).
* If valid, it refreshes the application and opens a report named "Process Sheet Print" in print mode (`A_PRINTALL`).
* The code is wrapped in an error handler (`Err_Button196_Click`) to catch any exceptions that may occur during execution.
## Button 200: Machines Link
---------------------------
* When this button is clicked, it:
* Opens a database named "MachQDB" and retrieves the machines data set.
* Calls the `search` subroutine to check if the part exists in the machines table.
* If not found, it adds a new machine record with the specified part number.
* The code is wrapped in an error handler (`Err_Button200_Click`) to catch any exceptions that may occur during execution.
## Button 204: Data Sheet Select
-------------------------------
* When this button is clicked, it:
* Opens a form named "Data Sheet Select" and sets the link criteria to the part number.
* Finds the first record with the specified part number using `DoCmd.FindRecord`.
* Retrieves the primary screen data set using `DoCmd.SelectObject A_FORM, PrimaryScreen$`.
* The code is wrapped in an error handler (`Err_Button224_Click`) to catch any exceptions that may occur during execution.
## Button 246: History Report
---------------------------
* When this button is clicked, it calls the `HistoryR` subroutine without any parameters.
## Button 247: Yes/No Confirmation
-------------------------------
* When this button is clicked, it:
* Opens a form named "YESORNO".
* Enters the text "delete this part" into the YesOrNoStr$ variable.
* Loops until YESORNO% \u003e 0, allowing the user to confirm or cancel the action.
* If the user confirms (i.e., YESORNO% = 1), it calls the `Delete_Part` subroutine.
## Button 248: Edit Shear Files
---------------------------
* When this button is clicked, it calls the `Edit_The_Shear_Files` subroutine without any parameters.
## Button 249: Find By Part Number
-------------------------------
* When this button is clicked, it calls the `Find_By_PartNumber` subroutine without any parameters.
## Button 288: Get PN$
--------------------
* When this button is clicked, it retrieves the value of the part number from the current form using `Me![PartNumber]`.
## Buttons and Subroutines Overview
--------------------------------------
The provided code snippet covers various event handlers for different buttons in an Access application. It contains a mix of data manipulation, report printing, and user confirmation subroutines, wrapped in error handling mechanisms to ensure robustness and fault tolerance.
### Key Functions
* `AddPartButton`: Adds a new part record to the database.
* `Print Report`: Prints a report with process sheet data.
* `Machines Link`: Checks if a machine exists for the specified part number and adds it if not found.
* `Data Sheet Select`: Opens a form to select data based on the part number.
* `History Report`: Calls a subroutine to generate a history report.
* `Yes/No Confirmation`: Displays a confirmation dialog box for deleting parts.
* `Edit Shear Files` and `Find By Part Number`: Call subroutines related to editing shear files and finding parts by part numbers, respectively.
### Error Handling
The code includes error handlers for each button's event handler to catch any exceptions that may occur during execution. This ensures that the application remains stable even in the presence of errors or unexpected user interactions.

384
Forms/term Process Sheet.md Normal file
View File

@ -0,0 +1,384 @@
# 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.

221
Forms/test1.md Normal file
View File

@ -0,0 +1,221 @@
# test1
Analysis generated on: 4/1/2025 4:05:35 PM
---
## Record Source
- [[Tables/Util Selection C1]]
## Controls
| Control Name | Reference |
|--------------|-----------|
| Combo12 (Row Source) | [[Tables/[Metals];]] |
| ACTIV | ACTIV (from [[Tables/Util Selection C1]]) |
| PHANT | PHANT (from [[Tables/Util Selection C1]]) |
| MAKE# | MAKE# (from [[Tables/Util Selection C1]]) |
| DESCP | DESCP (from [[Tables/Util Selection C1]]) |
| ITTYP | ITTYP (from [[Tables/Util Selection C1]]) |
| USAGE | USAGE (from [[Tables/Util Selection C1]]) |
| PMNAS | PMNAS (from [[Tables/Util Selection C1]]) |
| WOQTY | WOQTY (from [[Tables/Util Selection C1]]) |
| BSIZE2 | BSIZE2 (from [[Tables/Util Selection C1]]) |
| PartNumber | PartNumber (from [[Tables/Util Selection C1]]) |
| PhantomNumber | PhantomNumber (from [[Tables/Util Selection C1]]) |
| Warehouse | Warehouse (from [[Tables/Util Selection C1]]) |
| Flag | Flag (from [[Tables/Util Selection C1]]) |
| PartName | PartName (from [[Tables/Util Selection C1]]) |
| RevisionLevel | RevisionLevel (from [[Tables/Util Selection C1]]) |
| IssueNumber | IssueNumber (from [[Tables/Util Selection C1]]) |
| IssueDate | IssueDate (from [[Tables/Util Selection C1]]) |
| PreviousIssue | PreviousIssue (from [[Tables/Util Selection C1]]) |
| PreviousDate | PreviousDate (from [[Tables/Util Selection C1]]) |
| Reason | Reason (from [[Tables/Util Selection C1]]) |
| Programmer | Programmer (from [[Tables/Util Selection C1]]) |
| PrintSize | PrintSize (from [[Tables/Util Selection C1]]) |
| History | History (from [[Tables/Util Selection C1]]) |
| MetalType | MetalType (from [[Tables/Util Selection C1]]) |
| CutType | CutType (from [[Tables/Util Selection C1]]) |
| PunchOption | PunchOption (from [[Tables/Util Selection C1]]) |
| PunchNumber | PunchNumber (from [[Tables/Util Selection C1]]) |
| PunchPartsPerStrip | PunchPartsPerStrip (from [[Tables/Util Selection C1]]) |
| PunchStd | PunchStd (from [[Tables/Util Selection C1]]) |
| GrainShear | GrainShear (from [[Tables/Util Selection C1]]) |
| PrimeMachine | PrimeMachine (from [[Tables/Util Selection C1]]) |
| GrainDir | GrainDir (from [[Tables/Util Selection C1]]) |
| GrainNone | GrainNone (from [[Tables/Util Selection C1]]) |
| Deburr | Deburr (from [[Tables/Util Selection C1]]) |
| CellDeburrTypes | CellDeburrTypes (from [[Tables/Util Selection C1]]) |
| AddnlDeburrInches | AddnlDeburrInches (from [[Tables/Util Selection C1]]) |
| FirstDim | FirstDim (from [[Tables/Util Selection C1]]) |
| SecDim | SecDim (from [[Tables/Util Selection C1]]) |
| PartsPerBlank | PartsPerBlank (from [[Tables/Util Selection C1]]) |
| PartsPerSheet | PartsPerSheet (from [[Tables/Util Selection C1]]) |
| BlocksPerSheet | BlocksPerSheet (from [[Tables/Util Selection C1]]) |
| BlanksPerBlock | BlanksPerBlock (from [[Tables/Util Selection C1]]) |
| PartHeight | PartHeight (from [[Tables/Util Selection C1]]) |
| PartWidth | PartWidth (from [[Tables/Util Selection C1]]) |
| BotTrimCut | BotTrimCut (from [[Tables/Util Selection C1]]) |
| TopTrimCut | TopTrimCut (from [[Tables/Util Selection C1]]) |
| ActualPartHeight | ActualPartHeight (from [[Tables/Util Selection C1]]) |
| ActualPartWidth | ActualPartWidth (from [[Tables/Util Selection C1]]) |
| PressBrake | PressBrake (from [[Tables/Util Selection C1]]) |
| BlankSize | BlankSize (from [[Tables/Util Selection C1]]) |
| PartSize | PartSize (from [[Tables/Util Selection C1]]) |
| Text44 | GrossWt (from [[Tables/Util Selection C1]]) |
| Text45 | ActualWt (from [[Tables/Util Selection C1]]) |
| Utilization | Utilization (from [[Tables/Util Selection C1]]) |
| SheetSize | SheetSize (from [[Tables/Util Selection C1]]) |
| MaterialCost | MaterialCost (from [[Tables/Util Selection C1]]) |
| LaborCost | LaborCost (from [[Tables/Util Selection C1]]) |
| PartCost | PartCost (from [[Tables/Util Selection C1]]) |
| CalculationStatus | CalculationStatus (from [[Tables/Util Selection C1]]) |
| PaperLaserFlag | PaperLaserFlag (from [[Tables/Util Selection C1]]) |
## VBA Code
```vba
Option Compare Database
Private Sub cmdButtnCalc_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Selecting Parts for AS400 Transfer"
DoCmd.RunMacro "Material Selections for Utilitzation"
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Util Selection 2") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
MainSet.MoveFirst
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
lblstatus.Caption = "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
UtilResult1.SourceObject = "tricks"
DoCmd.RunMacro "AS400 Utiliz Results"
UtilResult1.SourceObject = "Util Result1"
' lblStatus.Caption = "Calculating material utilization on parts"
lblstatus.Caption = "Done"
End Sub
Private Sub Command25_Click()
lblstatus.Caption = "Start"
For i% = 1 To 149
Sheet_Width! = SheetWidth
Sheet_Length! = SheetLength
lb_per_sq_ft! = Density
Call UtilGrossWt(Sheet_Width!, Sheet_Length!, lb_per_sq_ft!, Gw!, Aw!)
GrossWt = Gw!
ActualWt = Aw!
Next
lblstatus.Caption = "calculating" + Str$(i%)
End Sub
Private Sub Command43_Click()
On Error GoTo Err_Command43_Click
Call Form.Command120_Click
' DoCmd.GoToRecord acDataForm, "UtilResult1", acNext
Exit_Command43_Click:
Exit Sub
Err_Command43_Click:
MsgBox Err.Description
Resume Exit_Command43_Click
End Sub
Private Sub Command44_Click()
On Error GoTo Err_Command44_Click
DoCmd.GoToRecord , , acNext
Exit_Command44_Click:
Exit Sub
Err_Command44_Click:
MsgBox Err.Description
Resume Exit_Command44_Click
End Sub
```
## What it does
**VBA Code Description**
==========================
This VBA code is written in Access 2003 and appears to be part of an application that interacts with an AS400 (America's System 400) database. The code consists of three subroutines: `cmdButtnCalc_Click`, `Command25_Click`, and `Command43_Click`.
**cmdButtnCalc_Click Subroutine**
----------------------------------
This subroutine is triggered by a button click event. It performs the following actions:
1. **Initialization**: Sets up two databases (`MainDB` and `MainDB2`) and recordsets (`MainSet` and `MainSet2`) to interact with the AS400 database.
2. **Material Selections for Utilitzation Macro**: Runs a macro named "Material Selections for Utilitzation" to select parts from the RMSFILES#_IEMUP1A0 table in the MainDB database.
3. **Purging AS400 product number file**: Deletes all records from the UtilSelection2 table in the MainDB2 database using a loop, ensuring that no duplicate product numbers are left behind.
4. **Purging AS400 result file**: Adds new records to the UtilSelection2 table by copying the product number from another table and updating the PRDNO field.
5. **Activating AS400 Program**: Activates an external program or process by calling `ActiveXCtl24.DoClick`.
6. **Retrieving Results Macro**: Runs a macro named "AS400 Utiliz Results" to retrieve results from the AS400 database.
7. **Final Status Update**: Updates the label caption with a final status message indicating that the calculation is complete.
**Command25_Click Subroutine**
------------------------------
This subroutine appears to be used for calculating material utilization on parts. It:
1. Loops 149 times, updating several variables (`Sheet_Width`, `Sheet_Length`, and `lb_per_sq_ft`) in each iteration.
2. Calls a function named `UtilGrossWt` with the updated values to calculate the gross weight of the material.
3. Updates the `GrossWt` and `ActualWt` variables with the calculated values.
**Command43_Click Subroutine**
------------------------------
This subroutine is used to navigate to another record in the UtilResult1 table. It:
1. Calls a macro named "Form.Command120_Click", which likely updates the current record.
2. Attempts to navigate to the next record using `DoCmd.GoToRecord`.
3. Catches any errors that occur during navigation and displays an error message.
**Command44_Click Subroutine**
------------------------------
This subroutine is used to navigate to another record in the UtilResult1 table, similar to Command43_Click. It:
1. Calls a macro named "Form.Command120_Click", which likely updates the current record.
2. Attempts to navigate to the next record using `DoCmd.GoToRecord`.
3. Catches any errors that occur during navigation and displays an error message.
**Error Handling**
------------------
The code uses error handling mechanisms (`On Error GoTo Err Command43_Click` and `Err_Command43_Click`) to catch and display any errors that occur during execution.

696
Forms/xyz.md Normal file
View File

@ -0,0 +1,696 @@
# xyz
Analysis generated on: 4/1/2025 4:01:32 PM
---
## Record Source
- *None*
## Controls
| Control Name | Reference |
|--------------|-----------|
| List86 (Row Source) | |
## VBA Code
```vba
Option Compare Database
Dim fromar(10), toar(10), curar(10), CurrSetSize(10), Sheets
Dim BestSS(10, 3, 6)
' |
' +---------------------> 0 - Sheet Size
' 1 - Pounds used
' 2 - Price for sheet
'
Private Sub ActiveXCtl24_Click()
End Sub
Private Sub ActiveXCtl24_CommandComplete(ByVal returnValue As Long)
End Sub
Private Sub ActiveXCtl24_Updated(code As Integer)
End Sub
Private Sub BegLength_LostFocus()
Call CalcIters
End Sub
Private Sub BegWidth_LostFocus()
Call CalcIters
End Sub
Private Sub CalcIters()
sz1 = Abs(EndWidth - BegWidth)
If IncWidth <> 0 Then
sz1 = sz1 / Abs(IncWidth)
End If
sz1 = sz1 + 1
sz2 = Abs(EndLength - BegLength)
If IncLength <> 0 Then
sz2 = sz2 / Abs(IncLength)
End If
sz2 = sz2 + 1
sz1 = sz1 * sz2
Iterations = Format$(sz1, "0")
End Sub
Private Sub cmdButtnCalc_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
lblstatus.Caption = "Selecting Parts for Material Utilization"
DoCmd.RunMacro "Material Selections for Utilitzation"
lblstatus.Caption = "Selection Complete"
Refresh
lblstatus.Caption = "Moving Parts to AS400"
Set MainSet = MainDB.OpenRecordset("RMSFILES#_IEMUP1A0") ' Create dynaset.
Set MainSet2 = MainDB2.OpenRecordset("Util Selection 2") ' Create dynaset.
lblstatus.Caption = "Purging AS400 product number file"
MainSet.MoveFirst
Do
If Not (MainSet.EOF) Then
MainSet.Delete
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
lblstatus.Caption = "Purging AS400 result file"
MainSet2.MoveFirst
Do
If Not (MainSet2.EOF) Then
p$ = MainSet2!prt
MainSet.AddNew
MainSet!PRDNO = p$
MainSet.Update
DoEvents
Else
DoEvents
Exit Do
End If
MainSet2.MoveNext
Loop
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
UtilResult1.SourceObject = "tricks"
DoCmd.RunMacro "AS400 Utiliz Results"
UtilResult1.SourceObject = "Util Result1"
' lblStatus.Caption = "Calculating material utilization on parts"
lblstatus.Caption = "Done"
End Sub
Private Sub Command25_Click()
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util Selection C1") ' Create dynaset.
Dim Main2DB As Database, Main2Set As Recordset
Set Main2DB = DBEngine.Workspaces(0).Databases(0)
Set Main2Set = Main2DB.OpenRecordset("Util Matrix") ' Create dynaset.
BGW! = BegWidth
EDW! = EndWidth
ICW! = IncWidth
BGL! = BegLength
EDL! = EndLength
ICL! = IncLength
lb_per_sq_ft! = Density
If lb_per_sq_ft! = 0 Then
Call MsgBox("No density entered.")
Exit Sub
End If
First = True
For Sheet_Width! = BGW! To EDW! Step ICW!
For Sheet_Length! = BGL! To EDL! Step ICL!
SheetWidth = Sheet_Width!
SheetLength = Sheet_Length!
GoSub DoSheetSize
Main2Set.AddNew
Main2Set!Gw = TotalGw!
Main2Set!SheetL = SheetLength
Main2Set!sheetw = SheetWidth
Main2Set.Update
If (First) Or (LGrossWt > TotalGw!) Then
LGrossWt = TotalGw!
LSheetL = SheetLength
LSheetW = SheetWidth
First = False
End If
Next
Next
Cost = 0
Exit Sub
DoSheetSize:
lblstatus.Caption = "Calculate Gross Weight for all parts at this sheet"
TotalGw! = 0
MainSet.MoveFirst
Do
If Not (MainSet.EOF) Then
If MainSet!Flag <> 1 Then
Sheet_Width! = SheetWidth
Sheet_Length! = SheetLength
Call UtilGrossWt(Sheet_Width!, Sheet_Length!, lb_per_sq_ft!, Gw!, Aw!, MainSet)
TotalGw! = Gw! + TotalGw!
End If
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
Return
End Sub
Private Sub Command43_Click()
On Error GoTo Err_Command43_Click
Call Form.Command120_Click
' DoCmd.GoToRecord acDataForm, "UtilResult1", acNext
Exit_Command43_Click:
Exit Sub
Err_Command43_Click:
MsgBox Err.Description
Resume Exit_Command43_Click
End Sub
Private Sub Command55_Click()
lblstatus.Caption = "Running Query to pick parts for Material Utilization"
DoCmd.RunMacro "Filter across Materials Utilitzation"
lblstatus.Caption = "Selection Complete"
Refresh
End Sub
Private Sub BestSheets_Click()
Call GetTheBestAnswers
End Sub
Private Sub cmdCreate_Click()
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util L X W") ' Create dynaset.
BGW! = BegWidth
EDW! = EndWidth
ICW! = IncWidth
BGL! = BegLength
EDL! = EndLength
ICL! = IncLength
For Sheet_Width! = BGW! To EDW! Step ICW!
For Sheet_Length! = BGL! To EDL! Step ICL!
MainSet.AddNew
MainSet!SheetL = Sheet_Length!
MainSet!sheetw = Sheet_Width!
MainSet.Update
Next
Next
Refresh
End Sub
Private Sub cmdLengths_Click()
SheetWidths! = Val(AddWidths)
Call Addparms(2, SheetWidths!)
Refresh
End Sub
Private Sub cmdWidths_Click()
SheetLength! = Val(AddLengths)
Call Addparms(1, SheetLength!)
Refresh
End Sub
Private Sub Command67_Click()
Cost = PricePerPound * LGrossWt
End Sub
Private Sub Command68_Click()
lblstatus.Caption = "Emptying Util Matrix"
DoCmd.CopyObject "Util L X W", acTable, "Util Matrix Zero"
End Sub
Private Sub Command79_Click()
'
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util Selection C1") ' Create dynaset.
Dim Main2DB As Database, Main2Set As Recordset
Set Main2DB = DBEngine.Workspaces(0).Databases(0)
Set Main2Set = Main2DB.OpenRecordset("Util L X W") ' Create dynaset.
Main2Set.Index = "Primary Key"
LGrossWt.SetFocus
Command79.Enabled = False
lb_per_sq_ft! = Density
If lb_per_sq_ft! = 0 Then
Call MsgBox("No density entered.")
Command79.Enabled = True
Exit Sub
End If
Sheets = Val(itsaNull$(NoOfSheets))
If Sheets > 10 Then
MsgBox ("Too Many Sheets")
Command79.Enabled = True
Exit Sub
End If
If Sheets < 1 Then
MsgBox ("No Sheets Entered")
Command79.Enabled = True
Exit Sub
End If
For SetNo = 0 To 10
For i = 0 To 3
For j = 0 To 6
BestSS(SetNo, i, j) = 0
Next
Next
'CurrSetSize(SetNo) = 0
Next
'
' Count up the number of iterations to go through
'
NoOfIters% = 0
lblstatus.Caption = "Numbering Iterations"
Main2Set.MoveFirst
Do
If Not (Main2Set.EOF) Then
NoOfIters% = NoOfIters% + 1
Main2Set.Edit
Main2Set!idno = Right$("0000000000" + Trim$(Str$(NoOfIters%)), 10)
Main2Set.Update
DoEvents
Else
DoEvents
Exit Do
End If
Main2Set.MoveNext
Loop
If NoOfIters% < Sheets Then
MsgBox ("Not Enough Iterations")
Command79.Enabled = True
Exit Sub
End If
Iterations = NoOfIters%
GoSub Init_Iterations
FirstIter = True
Do
GoSub CalcGWforSet
ind = Sheets
Do ' This loop bumps the CPH (current place holder)
curar(ind) = curar(ind) + 1
If curar(ind) > toar(ind) Then ' IF the CPH exceed the limit
fromar(ind) = fromar(ind) + 1 ' start the CPH at the from+1
curar(ind) = fromar(ind) ' and dec back to the prev PH
ind = ind - 1
Else
ib = curar(ind) ' Otherwise, all PH to the rt
For ix = ind To Sheets ' should = CPH+1
curar(ix) = ib
ib = ib + 1
Next
Exit Do ' done
End If
Loop
dn = 0
For ind = 1 To Sheets ' Check to see if all PHs
If curar(ind) <> toar(ind) Then ' = the last toPHs
dn = 1 ' if not loop to top
Exit For
End If
Next
If dn = 0 Then ' if so do the last one
Exit Do
End If
Loop
GoSub CalcGWforSet
CurrentSheetSet = ""
a1$ = ""
a2$ = ""
ttl# = 0
For SetNo = 1 To Sheets
Key$ = Right$("0000000000" + Trim$(Str$(BestSS(SetNo, 0, 0))), 10)
GoSub GetSheetSize
a1$ = a1$ + " " + Trim$(Str$(Sheet_Width!)) + "X" + Trim$(Str$(Sheet_Length!)) + " =" + Format$(BestSS(SetNo, 1, 0), "0")
a2$ = a2$ + Chr$(34) + Trim$(Str$(Sheet_Width!)) + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + Trim$(Str$(Sheet_Length!)) + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + lpad$(Format$(BestSS(SetNo, 1, 0), "###,###,##0"), 12) + Chr$(34) + ";"
ttl# = ttl# + Val(Format(BestSS(SetNo, 1, 0), "0"))
Next
a2$ = a2$ + Chr$(34) + " " + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + "Total " + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + lpad$(Format$(ttl#, "###,###,##0"), 12) + Chr$(34)
BestSheetSet = a1$
List86.rowSource = a2$
Command79.Enabled = True
Exit Sub
CalcGWforSet:
TotalGw! = 0
a1$ = ""
For SetNo = 1 To Sheets
a1$ = a1$ + Str$(curar(SetNo))
CurrSetSize(SetNo) = 0
Next
CurrentSheetSet = a1$
MainSet.MoveFirst
Do
If Not (MainSet.EOF) Then
BestWt! = 0
For SetNo = 1 To Sheets
Key$ = Right$("0000000000" + Trim$(Str$(curar(SetNo))), 10)
GoSub GetSheetSize
Call UtilGrossWt(Sheet_Width!, Sheet_Length!, lb_per_sq_ft!, Gw!, Aw!, MainSet)
If SetNo = 1 Then
BestWt! = Gw!
BestSet = SetNo
Else
If BestWt! > Gw! Then
BestWt! = Gw!
BestSet = SetNo
End If
End If
Next
TotalGw! = BestWt! + TotalGw!
CurrSetSize(BestSet) = CurrSetSize(BestSet) + BestWt!
DoEvents
Else
DoEvents
Exit Do
End If
MainSet.MoveNext
Loop
If (TotalGw! < bestsetgw!) Or FirstIter Then
FirstIter = False
bestsetgw! = TotalGw!
LGrossWt = TotalGw!
BestSheetSet = CurrentSheetSet
For SetNo = 1 To Sheets
BestSS(SetNo, 0, 0) = curar(SetNo)
BestSS(SetNo, 1, 0) = CurrSetSize(SetNo)
For top6 = 6 To 1 Step -1
BestSS(SetNo, 0, top6) = BestSS(SetNo, 0, top6 - 1)
BestSS(SetNo, 1, top6) = BestSS(SetNo, 1, top6 - 1)
Next
Next
End If
Return
GetSheetSize:
Main2Set.MoveFirst
Main2Set.Seek "=", Key$
If Not (Main2Set.NoMatch) Then
Sheet_Width! = Val(Main2Set!sheetw)
Sheet_Length! = Val(Main2Set!SheetL)
End If
Return
Init_Iterations:
For i = 1 To 10
fromar(i) = 0
toar(i) = 0
curar(i) = 0
Next
j = Iterations - Sheets
For i = 1 To Sheets
fromar(i) = i
curar(i) = i
toar(i) = i + j
Next
Return
End Sub
Sub GiveAnswers(Sheets, XSize, Xincs)
For i = 1 To Sheets
Print Str$((curar(i) - 1) * Xincs + XSize) + " ";
Next
Print
End Sub
Private Sub EndLength_LostFocus()
Call CalcIters
End Sub
Private Sub EndWidth_LostFocus()
Call CalcIters
End Sub
Private Sub IncLength_LostFocus()
Call CalcIters
End Sub
Private Sub IncWidth_LostFocus()
Call CalcIters
End Sub
Private Sub cmdOpen14two_Click()
On Error GoTo Err_cmdOpen14two_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "14 two"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpen14two_Click:
Exit Sub
Err_cmdOpen14two_Click:
MsgBox Err.Description
Resume Exit_cmdOpen14two_Click
End Sub
Private Sub Addparms(i%, Sizeses!)
Dim MainDB As Database, MainSet As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainSet = MainDB.OpenRecordset("Util L X W") ' Create dynaset.
BGW! = BegWidth
EDW! = EndWidth
ICW! = IncWidth
BGL! = BegLength
EDL! = EndLength
ICL! = IncLength
If i% = 1 Then
BG! = BegWidth
ed! = EndWidth
IC! = IncWidth
Else
BG! = BegLength
ed! = EndLength
IC! = IncLength
End If
For SS! = BG! To ed! Step IC!
If i% = 1 Then
SheetWidth! = SS!
SheetLength! = Sizeses!
Else
SheetWidth! = Sizeses!
SheetLength! = SS!
End If
MainSet.AddNew
MainSet!SheetL = SheetLength!
MainSet!sheetw = SheetWidth!
MainSet.Update
Next
End Sub
Public Sub GetTheBestAnswers()
Dim Main2DB As Database, Main2Set As Recordset
Set Main2DB = DBEngine.Workspaces(0).Databases(0)
Set Main2Set = Main2DB.OpenRecordset("Util L X W") ' Create dynaset.
Main2Set.Index = "Primary Key"
A = BestSheets
If BestSS(1, 0, 0) = 0 Then
Exit Sub
End If
a1$ = ""
a2$ = ""
ttl# = 0
For SetNo = 1 To Sheets
Key$ = Right$("0000000000" + Trim$(Str$(BestSS(SetNo, 0, A))), 10)
GoSub GetTheSheetSize
a2$ = a2$ + Chr$(34) + Trim$(Str$(Sheet_Width!)) + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + Trim$(Str$(Sheet_Length!)) + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + lpad$(Format$(BestSS(SetNo, 1, A), "###,###,##0"), 12) + Chr$(34) + ";"
ttl# = ttl# + Val(Format(BestSS(SetNo, 1, A), "0"))
Next
a2$ = a2$ + Chr$(34) + " " + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + "Total " + Chr$(34) + ";"
a2$ = a2$ + Chr$(34) + lpad$(Format$(ttl#, "###,###,##0"), 12) + Chr$(34)
List86.rowSource = a2$
Exit Sub
GetTheSheetSize:
Main2Set.MoveFirst
Main2Set.Seek "=", Key$
If Not (Main2Set.NoMatch) Then
Sheet_Width! = Val(Main2Set!sheetw)
Sheet_Length! = Val(Main2Set!SheetL)
End If
Return
End Sub
```
## What it does
**ActiveX Control 24 Calculation and Material Utilization Code**
===========================================================
This VBA code is used to calculate material utilization for a set of parts in an Excel worksheet. It consists of several subroutines that perform the following tasks:
### Initialization and Event Handling
The code initializes variables and sets up event handlers for buttons and macros.
* `ActiveXCtl24_Click()`: Empty subroutine for handling button clicks.
* `ActiveXCtl24_CommandComplete()` and `ActiveXCtl24_Updated(code As Integer)`: Empty subroutines for handling command completion and updates.
* `BegLength_LostFocus()` and `BegWidth_LostFocus()`: Subroutines called when the length and width fields lose focus, which calls `CalcIters()` to update calculations.
### Calculation of Sheet Size and Material Utilization
The code uses several variables to store sheet size values:
* `sz1` and `sz2`: Calculated values for sheet size based on width and length changes.
* `Iterations`: Stores the number of iterations performed during calculations, formatted as a string (e.g., "123").
The `CalcIters()` subroutine calculates these values based on input field changes:
```markdown
Private Sub CalcIters()
sz1 = Abs(EndWidth - BegWidth)
If IncWidth \u003c\u003e 0 Then
sz1 = sz1 / Abs(IncWidth)
End If
sz1 = sz1 + 1
sz2 = Abs(EndLength - BegLength)
If IncLength \u003c\u003e 0 Then
sz2 = sz2 / Abs(IncLength)
End If
sz2 = sz2 + 1
sz1 = sz1 * sz2
Iterations = Format$(sz1, "0")
```
### Material Utilization Calculation and Macro Execution
The `cmdButtnCalc_Click()` subroutine performs the following steps:
* Retrieves data from two databases (`MainDB` and `MainDB2`) using dynamic recordsets.
* Purges existing records in the first database.
* Adds new records to the second database, including parts with calculated material utilization values.
* Activates an AS400 program using the `ActiveXCtl24.DoClick()` method.
```markdown
Private Sub cmdButtnCalc_Click()
Dim MainDB As Database, MainSet As Recordset
Dim MainDB2 As Database, MainSet2 As Recordset
Set MainDB = DBEngine.Workspaces(0).Databases(0)
Set MainDB2 = DBEngine.Workspaces(0).Databases(0)
' ... (parsing and modifying records in MainDB and MainDB2 databases) ...
lblstatus.Caption = "Activating AS400 Program"
DoEvents
ActiveXCtl24.DoClick
lblstatus.Caption = "Retrieving Results"
UtilResult1.SourceObject = "tricks"
DoCmd.RunMacro "AS400 Utiliz Results"
UtilResult1.SourceObject = "Util Result1"
lblstatus.Caption = "Done"
```
### Material Matrix Calculation and Display
The `Command25_Click()` subroutine:
* Retrieves data from two databases (`MainDB` and `Main2DB`) using dynamic recordsets.
* Iterates over sheet size values, adding new records to the second database with calculated material utilization values.
```markdown
Private Sub Command25_Click()
' ... (parsing and modifying records in MainDB and Main2DB databases) ...
Dim TotalGw! As Double
First = True
For Sheet_Width! = BGW! To EDW! Step ICW!
For Sheet_Length! = BGL! To EDL! Step ICL!
SheetWidth = Sheet_Width!
SheetLength = Sheet_Length!
GoSub DoSheetSize
Main2Set.AddNew
Main2Set!Gw = TotalGw!
Main2Set!SheetL = SheetLength
Main2Set!sheetw = SheetWidth
Main2Set.Update
If (First) Or (LGrossWt \u003e TotalGw!) Then
LGrossWt = TotalGw!
LSheetL = SheetLength
LSheetW = SheetWidth
First = False
End If
Next
Next
Cost = 0
End Sub
DoSheetSize:
' ... (calculate material utilization values based on current sheet size) ...
```

View File

@ -0,0 +1,22 @@
# AS400 Utiliz Results for steve
Analysis generated on: 4/1/2025 3:41:07 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 3; 0; 1 | - |
| OpenQuery | Util Result1 for steve; 0; 1 | - |
| OpenQuery | Util Results2 for steve; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 3; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Result1 for steve; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Results2 for steve; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

View File

@ -0,0 +1,16 @@
# AS400 Utiliz Results
Analysis generated on: 4/1/2025 3:41:04 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 3; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 3; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

13
Macros/AutoExec.md Normal file
View File

@ -0,0 +1,13 @@
# AutoExec
Analysis generated on: 4/1/2025 3:41:07 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| RunCode | ReadInits() | - |
| OpenForm | Main Menu; 0; 1; 0 | - |
## What it does
- **RunCode**: Performs an action: RunCode.
- **Arguments**: ReadInits()
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: Main Menu; 0; 1; 0

View File

@ -0,0 +1,16 @@
# Comparison Report
Analysis generated on: 4/1/2025 3:41:06 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenReport | Comparison from C1 Table; 2 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenReport**: Opens a specified report in the database.
- **Arguments**: Comparison from C1 Table; 2
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

22
Macros/Create Util 1.md Normal file
View File

@ -0,0 +1,22 @@
# Create Util 1
Analysis generated on: 4/1/2025 3:41:09 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 0; 0; 2 | - |
| OpenQuery | Util Flag Update; 0; 1 | - |
| OpenQuery | Util Make Select 1; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Flag Update; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 1; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

View File

@ -0,0 +1,25 @@
# Fake AS400 Utiliz Results
Analysis generated on: 4/1/2025 3:41:04 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 3 Fake; 0; 1 | - |
| OpenQuery | Util Result2; 0; 1 | - |
| OpenQuery | Zero Util Select 1 Flags; 0; 1 | - |
| OpenQuery | Util Set all zero usage parts to ignore; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 3 Fake; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Result2; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Zero Util Select 1 Flags; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Set all zero usage parts to ignore; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

View File

@ -0,0 +1,19 @@
# Filter across Materials Utilitzation
Analysis generated on: 4/1/2025 3:41:10 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 0; 0; 2 | - |
| OpenQuery | Zero Util Select 0 Flags; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Zero Util Select 0 Flags; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

13
Macros/Macro1.md Normal file
View File

@ -0,0 +1,13 @@
# Macro1
Analysis generated on: 4/1/2025 3:41:10 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| OpenForm | TestEntryForm; 0; 1; 0 | - |
| SetValue | [Forms]![TestEntryForm]![Entry]; 45 | - |
## What it does
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: TestEntryForm; 0; 1; 0
- **SetValue**: Performs an action: SetValue.
- **Arguments**: [Forms]![TestEntryForm]![Entry]; 45

10
Macros/Macro2.md Normal file
View File

@ -0,0 +1,10 @@
# Macro2
Analysis generated on: 4/1/2025 3:41:08 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| TransferSpreadsheet | 1; 5; Query5; l:\\q5.xls; 0 | - |
## What it does
- **TransferSpreadsheet**: Performs an action: TransferSpreadsheet.
- **Arguments**: 1; 5; Query5; l:\\q5.xls; 0

View File

@ -0,0 +1,34 @@
# Material Selections for Utilitzation
Analysis generated on: 4/1/2025 3:41:09 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| CopyObject | Util Selection 1; 0; Tricks | - |
| CopyObject | Util Selection 2; 0; Tricks | - |
| DeleteObject | 0; Util Selection 1 | - |
| DeleteObject | 0; Util Selection 2 | - |
| OpenQuery | Util Make Select 1; 0; 2 | - |
| OpenQuery | Util Flag Update; 0; 1 | - |
| OpenQuery | Util Make Select 2; 0; 1 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **CopyObject**: Copies an object (e.g., a table, query, or form) to a new name or location.
- **Arguments**: Util Selection 1; 0; Tricks
- **CopyObject**: Copies an object (e.g., a table, query, or form) to a new name or location.
- **Arguments**: Util Selection 2; 0; Tricks
- **DeleteObject**: Performs an action: DeleteObject.
- **Arguments**: 0; Util Selection 1
- **DeleteObject**: Performs an action: DeleteObject.
- **Arguments**: 0; Util Selection 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 1; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Flag Update; 0; 1
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 2; 0; 1
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

View File

@ -0,0 +1,16 @@
# Material Upgrade
Analysis generated on: 4/1/2025 3:41:06 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenForm | Material Upgrade; 0; -1; 0 | - |
| Close | 2; Sheet Utilization Utilites; 0 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: Material Upgrade; 0; -1; 0
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Sheet Utilization Utilites; 0

View File

@ -0,0 +1,10 @@
# MaterialCalculate
Analysis generated on: 4/1/2025 3:41:11 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| OpenForm | 14\" Process Sheet; 0; UQ-14; 1; 0 | - |
## What it does
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: 14\" Process Sheet; 0; UQ-14; 1; 0

16
Macros/Notes for Util.md Normal file
View File

@ -0,0 +1,16 @@
# Notes for Util
Analysis generated on: 4/1/2025 3:41:11 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenTable | Notes for Util; 0; 2 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenTable**: Performs an action: OpenTable.
- **Arguments**: Notes for Util; 0; 2
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

View File

@ -0,0 +1,13 @@
# Open Processes by List
Analysis generated on: 4/1/2025 3:41:13 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenTable | Process by List; 0; 1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenTable**: Performs an action: OpenTable.
- **Arguments**: Process by List; 0; 1

10
Macros/OpenUpC1.md Normal file
View File

@ -0,0 +1,10 @@
# OpenUpC1
Analysis generated on: 4/1/2025 3:41:14 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| OpenTable | Util Selection C1; 0; 1 | - |
## What it does
- **OpenTable**: Performs an action: OpenTable.
- **Arguments**: Util Selection C1; 0; 1

View File

@ -0,0 +1,13 @@
# OpenUpGaugeTable
Analysis generated on: 4/1/2025 3:41:14 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| OpenTable | MetalPrices; 0; 1 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **OpenTable**: Performs an action: OpenTable.
- **Arguments**: MetalPrices; 0; 1
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

7
Macros/PASSMATER.md Normal file
View File

@ -0,0 +1,7 @@
# PASSMATER
Analysis generated on: 4/1/2025 3:41:08 PM
---
## Macro Definition
- *No actions found or failed to parse macro definition*
## What it does
- *No actions to describe due to parsing failure*

16
Macros/Process 14 two.md Normal file
View File

@ -0,0 +1,16 @@
# Process 14 two
Analysis generated on: 4/1/2025 3:41:15 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenForm | 14 two; 0; -1; 0 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: 14 two; 0; -1; 0
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

View File

@ -0,0 +1,25 @@
# QueryfromFilterParts3
Analysis generated on: 4/1/2025 3:41:15 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenQuery | Util Make Select 0a; 0; 2 | - |
| OpenQuery | Util Make Select 0b; 0; 2 | - |
| OpenQuery | Util Make Select 0c; 0; 2 | - |
| OpenQuery | Util Make Select 0d; 0; 2 | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0a; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0b; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0c; 0; 2
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: Util Make Select 0d; 0; 2
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

View File

@ -0,0 +1,13 @@
# Restore Util Selection C1
Analysis generated on: 4/1/2025 3:41:16 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| CopyObject | Util Selection C1; 0; SP 8110950 20 ga SS | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **CopyObject**: Copies an object (e.g., a table, query, or form) to a new name or location.
- **Arguments**: Util Selection C1; 0; SP 8110950 20 ga SS

View File

@ -0,0 +1,16 @@
# Return to Utilization Form
Analysis generated on: 4/1/2025 3:41:16 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenForm | Utilization on Multiple Sheets; 0; -1; 0 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenForm**: Opens a specified form in the database.
- **Arguments**: Utilization on Multiple Sheets; 0; -1; 0
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

View File

@ -0,0 +1,19 @@
# SP C1 Report Macro
Analysis generated on: 4/1/2025 3:41:17 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| OpenQuery | SP Util C1 Comparison; 0; 2 | - |
| Close | 1; SP Util C1 Comparison; 1 | - |
| OpenReport | SP Material Utilization by Product C1 Comparison; 2 | - |
| Close | 2; Miscellaneous; 0 | - |
## What it does
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: SP Util C1 Comparison; 0; 2
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 1; SP Util C1 Comparison; 1
- **OpenReport**: Opens a specified report in the database.
- **Arguments**: SP Material Utilization by Product C1 Comparison; 2
- **Close**: Closes a specified object (e.g., a form, report, or query).
- **Arguments**: 2; Miscellaneous; 0

16
Macros/SP Make table.md Normal file
View File

@ -0,0 +1,16 @@
# SP Make table
Analysis generated on: 4/1/2025 3:41:17 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| CopyObject | SP none; 0; SP stupid | - |
| OpenQuery | SP Product Filter; 0; 1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **CopyObject**: Copies an object (e.g., a table, query, or form) to a new name or location.
- **Arguments**: SP none; 0; SP stupid
- **OpenQuery**: Runs a specified query in the database.
- **Arguments**: SP Product Filter; 0; 1

13
Macros/Tricks.md Normal file
View File

@ -0,0 +1,13 @@
# Tricks
Analysis generated on: 4/1/2025 3:41:13 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| OpenTable | Tricks; 0; 2 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **OpenTable**: Performs an action: OpenTable.
- **Arguments**: Tricks; 0; 2

View File

@ -0,0 +1,16 @@
# Zero Util Matrix
Analysis generated on: 4/1/2025 3:41:12 PM
---
## Macro Definition
| Action | Arguments | Condition |
|--------|-----------|-----------|
| SetWarnings | 0 | - |
| CopyObject | Util Matrix; 0; Util Matrix Zero | - |
| SetWarnings | -1 | - |
## What it does
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: 0
- **CopyObject**: Copies an object (e.g., a table, query, or form) to a new name or location.
- **Arguments**: Util Matrix; 0; Util Matrix Zero
- **SetWarnings**: Enables or disables system warnings (e.g., confirmation dialogs for actions).
- **Arguments**: -1

Some files were not shown because too many files have changed in this diff Show More