Find Records on Subform

  • Thread starter Thread starter help
  • Start date Start date
H

help

I have a Find Record command button on a main form. When
I click on the subform and click "Find Record" I recieve
the message, "Cannot Find and Replace". How do I find
records on the subform? TIA
 
You could use a combox. Put a combobox in the main form, with the combobox
value keyed to look up records in the subform. You'll have an AfterUpdate
procedure for the combobox like this:

Dim rst As DAO.Recordset
Dim strSearchName As String

Set rst = Me.Recordset.Clone

strSearchName = Str(Me![AttorneyFile])
rst.FindFirst "[CaseID] = " & strSearchName
Me.Bookmark = rst.Bookmark
If rst.NoMatch Then
MsgBox "Record not found"
End If
rst.Close

And the Row Source of the combobox something like:

SELECT tblLegalProceedings.CaseCode, tblLegalProceedings.AttorneyFileNumber
FROM tblLegalProceedings
WHERE (((tblLegalProceedings.AttorneyFileNumber) Is Not Null))
ORDER BY tblLegalProceedings.AttorneyFileNumber;
 
help said:
I have a Find Record command button on a main form. When
I click on the subform and click "Find Record" I recieve
the message, "Cannot Find and Replace". How do I find
records on the subform? TIA

What does your Find Record button actually do? Just open the built-in
Find And Replace dialog? Probably all you need is to insert a line
before you open that dialog that sets the focus back to the subform
control. Something like:

Me!NameOfSubformControl.SetFocus

(where "NameOfSubformControl" is the name of the subform control *on the
main form* that displays your subform.)
 
Back
Top