My brewery client normally uses barcode readers to feed data into the main database when processing orders. Sometimes the readers fail and they need some manual processes.
One of these is to update a table 'Casks Racked/Sold' that had been part completed previously with details of casks in stock, each having a unique CaskID.
Building an order leads to a new OrderDetailID for the cask to be used, and it's this that needs to be added to the Casks Racked/Sold table.
I'm using an intermediate form frmBookout to assemble all relevant details, including the Cask ID which appears on a label attached to the cask. To initiate booking out the cask this code asks the user to input the CaskID, assigning it to NewCaskID.
Code:
Private Sub cboUpdateDetails_Click()
On Error GoTo Err_cmdUpdateDetails_Click
Dim NewCaskID As Long
NewCaskID = InputBox("Enter Cask Number")
DoCmd.RunSQL "UPDATE [Casks Racked/Sold] SET [OrderDetailID]=forms!frmBookOut.[OrderDetailID] WHERE [CaskID]=NewCaskID"
Exit_cmdUpdateDetails_Click:
Exit Sub
Err_cmdUpdateDetails_Click:
MsgBox Err.Description
Resume Exit_cmdUpdateDetails_Click
End Sub
But this gives a prompt asking for the parameter value NewCaskID, which I was expecting it to already have.