62 lines
2.0 KiB
Markdown
62 lines
2.0 KiB
Markdown
# CNCDefinitions
|
|
---
|
|
## 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.
|