Hi everyone!,
It has been a while since I've really needed some help. I know my indents are atrocious but i do this in spare time to help automate things at work and im still learning.Private Sub CmdProcess_Click() IF STATEMENT.txt
Private Sub CmdProcess_Click()
DoCmd.SetWarnings False
If IsNull(Forms![Frm_InventoryMoves]![CmbTXName]) Then
MsgBox "You MUST enter your name in the [Person Performing Transaction] box ", , "NO PERSON PERFORMING TRANSACTION !" ' Checks to see if Person Performming transaction field is empty
Exit Sub
End If
Dim db As DAO.Database
Dim tbl_Move_Temp2 As DAO.TableDef
Dim tbl_Inventory As DAO.TableDef
Dim partNum1 As String
Dim partNum2 As String
Set db = CurrentDb()
Set tbl_Move_Temp2 = db.TableDefs("Tbl_Move_Temp2")
Set tbl_Inventory = db.TableDefs("Tbl_Inventory")
If CStr(partNum1) = CStr(partNum2) Then
DoCmd.OpenQuery "Qry_Move_Consumption", acViewNormal
DoCmd.OpenQuery "Qry_InventoryMoveConsumption Append", acViewNormal 'Appends consumption record to Archive
DoCmd.OpenQuery "Qry_MoveTemp2Consumption DELETE", acViewNormal 'Deletes consumption items based on the 2nd temp table
DoCmd.OpenQuery "Qry_InventoryAddition Update", acViewNormal ' Adds to location
DoCmd.OpenQuery "Qry_InventorySubtract Update", acViewNormal ' Subtracts from locations
DoCmd.OpenQuery "Qry_InventoryMove Append", acViewNormal 'Appends to the Archive file
DoCmd.OpenQuery "Qry_CleanZeroInventory", acViewNormal 'Cleans Inventory
Else
DoCmd.OpenQuery "Qry_Move_Consumption", acViewNormal
DoCmd.OpenQuery "Qry_InventoryMoveConsumption Append", acViewNormal 'Appends consumption record to Archive
DoCmd.OpenQuery "Qry_MoveTemp2Consumption DELETE", acViewNormal 'Deletes consumption items based on the 2nd temp table
DoCmd.OpenQuery "Qry_InventoryAddition Update", acViewNormal ' Adds to location
DoCmd.OpenQuery "Qry_InventorySubtract Update", acViewNormal ' Subtracts from locations
DoCmd.OpenQuery "Qry_InventoryMoveNewRecord APPEND", acViewNormal 'Appends the move to inventory table (Only if there isnt a record already)
DoCmd.OpenQuery "Qry_InventoryMove Append", acViewNormal 'Appends to the Archive file
DoCmd.OpenQuery "Qry_CleanZeroInventory", acViewNormal 'Cleans Inventory
End If
DoCmd.OpenQuery "Qry_MoveTemp2 DELETE", acViewNormal 'deletes records that were moved
DoCmd.OpenQuery "Qry_MoveTempClean DELETE", acViewNormal 'Cleans top temp table
Me![CmbName] = Null
Me![Combo17] = Null
DoCmd.ShowAllRecords
[CmbPN].SetFocus
DoCmd.SetWarnings True
End Sub