I had a little trouble with the code, but got it to work with locally stored variables.
It was giving Run time Error 2465
Here is the complete function. I'm working on learning how to implement error handling.
For example, a field is not entered and is considered Null.
Code:
Private Sub CapsuleAutoFill_Click()
Dim LintCapsules As Long
Dim intOrderIndex As Integer
On Error GoTo Error_Message
Exit Sub
Error_Message:
Select Case Err.Number
Case Else
MsgBox "Please fill in form"
End Select
LintCapsules = Me.TXT_CapsulesRan
intOrderIndex = Me.CBO_OrderNumSel
CurrentDb.Execute "UPDATE T_Order_Details SET [T_Order_Details].[Capsules_Ran] = " & LintCapsules & " WHERE Order_ID = " & intOrderIndex
DoCmd.Requery "T_Order_Details Query Subform1"
End Sub