Hi All,
I'm trying to find a record using data from a Combo Box drop down list. For the most part it's working except for the actual DoCmd.FindRecord bit of the code, which is generating an error.
From a control on the SubForm, the user selects the search criteria from the Combo Box drop-down list. Then in the AfterUpdate Event, I have the following code which traps the search criteria and uses it to find the relevant record on the Main (parent) Form. These are the relevant lines of code:
Parent.CmbCustID.SetFocus
DoCmd.FindRecord lngCustNo, acEntire, False, acSearchAll, False, acCurrent, True
Me.CmbInvoiceNo.SetFocus
First line shifts focus to the Main Form
The second line finds the record (this is where the error is occurring)
The Third line shifts the focus back to the SubForm.
The error produced by the DoCmd.FindRecord method, is, " a macro set to one of the current field's properties failed because of an error in a Find Record action argument."
I've gone through the DoCmd.FindRecord statement and can find nothing wrong with it. The lngCustNo (long integer) is correct. My only concern is this - is the first line actually shifting the focus to the control on the Main (parent) Form? Or is the DoCmd.FindRecord method trying to find the criteria in field that is active at the time the Combo Box event is triggered? How can I check for sure where the focus really is at the time the DoCmd.FindRecord method is executed?
Prof.