# MakeForm --- ## 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.