Hi I have the following code that runs when my Inventory transactions form is opened. The code's purpose is when the user opens it from a button on my Order details form is to automatically subtract the quantity ordered from inventory. It works, but gives a message saying the open form action was cancelled and gives no clue that it was successful. Is there a way to stop this message and replace it with confirmation that the action was successful?
Private Sub Form_Load()
Dim lngProduct As Long
Dim intPos As Integer
Dim lngProductQty As Long
If Not IsNull(Me.OpenArgs) Then
' Position of pipe
intPos = InStr(Me.OpenArgs, "|")
If intPos > 0 Then
' Retrieve Product from 1st part of string
lngProduct = Left$(Me.OpenArgs, intPos - 1)
' Retrieve ProductQty from the end of string
lngProductQty = Mid$(Me.OpenArgs, intPos + 1)
DoCmd.GoToRecord , , acNewRec
'Assign 1st value to control
Me.Product.SetFocus
Me.Product = lngProduct
Me.TransactionType.SetFocus
Me.TransactionType = "Remove"
'Assign end value to control
Me.TransactionQty.SetFocus
Me.TransactionQty = lngProductQty
End If
DoCmd.Save
DoCmd.Close
Else
End If
End Sub