initial commit
parent
5ed90c83b1
commit
9139abeaff
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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*
|
||||
|
|
@ -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*
|
||||
|
|
@ -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*
|
||||
|
|
@ -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*
|
||||
|
|
@ -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.
|
||||
|
|
@ -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
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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]`.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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*
|
||||
|
|
@ -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*
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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*
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
|
@ -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*
|
||||
|
|
@ -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.
|
||||
|
|
@ -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*
|
||||
|
|
@ -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()`
|
||||
| < | ||||