This is when I attempt to use SearchForRecord with a filter. It works any other time. Here's my code:
Private Sub cmdDeleteRecord_Click() If Not (Form.NewRecord) Then DeleteRecord Else If (Form.Dirty) Then DoCmd.RunCommand acCmdUndo End If End If LoadCurrentBCM End Sub Private Sub DeleteRecord() If Not (strEmpName.OldValue = txtBCMName.Value) Then DoCmd.RunCommand acCmdDeleteRecord Else MsgBox "You cannot delete yourself." End If End Sub Private Sub LoadCurrentBCM() Dim BCM As String BCM = DLookup("lngEmpID", "tblCurrentBCM") 'cboBCMs = BCM 'lngEmpID = BCM 'strEmpName = Me.txtBCMName cboBCMs = BCM Me.Requery DoCmd.SearchForRecord , , acFirst, "[lngEmpID] = '" & BCM & "'" 'ERROR HERE RequeryBCMs End Sub Public Sub UpdateBCMs() If Me.Dirty = True Then DoCmd.RunCommand acCmdUndo DoCmd.SearchForRecord , , acFirst, "[lngEmpID] = '" & cboBCMs & "'" End Sub Private Sub RequeryBCMs() Me.cboBCMs.Requery Me.lstChangeLog.Requery Me.lstLoginLog.Requery End Sub
The LoadCurrentBCM sub is kinda messy as I've been trying different things with it. The UpdateBCMs sub works flawlessly, and the LoadCurrentBCM sub even works if I do not delete the record (if it's still a new record and only does Undo instead). I'm at a loss as to why it fails after deleting a record but not any other time. Been fighting with this for a couple hours now, a fresh perspective will be greatly appreciated.
And the form IS bound to a query (qryBCM)