150 lines
4.9 KiB
Markdown
150 lines
4.9 KiB
Markdown
# DS Pem Press Manual
|
|
---
|
|
## 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.
|