69 lines
2.1 KiB
Markdown
69 lines
2.1 KiB
Markdown
# HoldPartNumberForm
|
|
---
|
|
## 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.
|