Search in subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alireza355
    New Member
    • Feb 2009
    • 86

    #1

    Search in subform

    Dear all,

    I have a main form with a subform in it, showing some data.

    I want to have a little form, called "Quick Search" for example, that has a textbox and 3 buttons: Find, Find Next and Close. I have done everything so far, but don't know how to make the "Find" and "Find Next" buttons find what I have typed in the textbox.

    I dont want the found text to be highlighted in the subform, because I have read in the internet that this can not be done easily with normal textboxes.

    So I guess highlighting the entire record would be fine. something like:

    Application.Run Command acCmdSelectReco rd

    would be fine for highlighting that row.

    But the problem I have is how to find my text in that subform, and how to make that record be pointed out from the rest of the records in the subform and Also, what code or query to use for the "Find Next" button?????

    Any help??????
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    The code for accessing the records in your form is not form related. This makes handling this job from a separate, pop-up form, more complicated. I would advise instead, having a facility on the subform itself if that's possible.

    The procedure(s) to call are :
    Code:
    DoCmd.FindRecord()
    DoCmd.FindNext()
    I suggest you look this up in Help to get all the details. How to use the various options and when to use each procedure.

    If you must use a separate form, then you'd need to select the subform of the main form and make it the current form before making either of these calls. You can see that there is nothing in the call to specify which object it's dealing with otherwise.

    Comment

    Working...