PSLine2000Documentation/Forms/DS Paper Peel.md

4.7 KiB

DS Paper Peel


Record Source

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

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.