Full Version: Search Form That Opens Main Form
UtterAccess Forums > Microsoft® Access > Access Forms
ShariT
I have created a search form that once the criteria is entered is displays all possible matches in a datasheet subform. What I would like to do is add an event on the click or doubleclick of the record that I select that would take me back to a main form with the record that was clicked on loaded on the main form.
Is that possible? I do have a little VBA experience, but not a lot.
Thanks for any suggestions.
rbianco
Is your "main form" bound or unbound. If it is bound...then go to your search results form, and temporarily build a button. When the command button wizard comes up select the events to open a form, and select your "main form" Since thee main form is bound, the wizard will ask you to "show all records" or "filter records". Select Filter records, and select the criteria that set the filter. Now that the button code is written by the wizard, go view the code it wrote. Copy the body of the code and place it in the click/double click event of the control on your search form. Then delete the temp button. Now when the control on your search detail form is clicked/double clicked it will open the "main form" filtered on the criteria being passed. This works even if the search detail form is in datasheet view. I use this bound approach all the time.
If your "main form" is unbound, then one way would be to create a temporary query def, and then populate the unbound controls on your main form with the values from your querydef.
ShariT
My form is bound, so I will give that a try. Thanks.
ShariT
It worked like a charm and so easy! Thanks so much.
rbianco
Glad to know you're good to go! :thumbup:" border="0" alt="thumbup.gif" />
ordnance1
Any chance you would be able to send a copy of your search form? I am working on just my second DB and I have been tring to figure out how to do what you have accomplished.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.