FindRecord Error

jsic1210

Registered User.
Local time
Today, 04:01
Joined
Feb 29, 2012
Messages
188
Hello,

I'm trying to find a subform record from a separate pop-up form based on its ContractID. When I click the button, I get the following error:
"A macro set to one of the current field's properties failed because of an error in a FindRecord action argument."
When I step through the code, it works just fine. Here is my code:
Code:
'Find contract
With Forms!frmContractForm.frmContractSub
    .Form.ContractID.Enabled = True
    .SetFocus
    .Form.ContractID.SetFocus
    DoCmd.FindRecord Me.ContractID
    .Form.Business.SetFocus
    .Form.ContractID.Enabled = False
End With
 
Not sure why the above wasn't working. But I added in a line to requery the main form first and that worked. My new code is:
Code:
'Requery contract
Forms!frmContractForm.Requery

'Find contract
With Forms!frmContractForm.frmContractSub
    .Form.ContractID.Enabled = True
    .SetFocus
    .Form.ContractID.SetFocus
    DoCmd.FindRecord Me.ContractID
    .Form.Business.SetFocus
    .Form.ContractID.Enabled = False
End With
 

Users who are viewing this thread

Back
Top Bottom