By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

Search in subform

P: 86
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.RunCommand acCmdSelectRecord

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??????
May 7 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,712
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 :
Expand|Select|Wrap|Line Numbers
  1. DoCmd.FindRecord()
  2. 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.
May 12 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.