Subform search update

irishblue

Registered User.
Local time
Today, 03:00
Joined
Jul 14, 2005
Messages
25
Hi everyone. This probably sounds simple, but I cannot find the answer here, google, or my books (don't know if I'm searching the right words). I have a main form with five parmeter values, any of these acn be filled in, to filter the results in a query. I created a subform to display these results, however I cannot get the results to come up in the subform inside the main form. All I can get is the subform opening up in its own window, and even when this happens the subform inside the mainform stays the same. The only way I get the subform inside to update is by going into design mode and then back into formview mode. What have I missed or what am I doing wrong?

Thanks to anyone who takes time on this question.
 
how are you updating the information on your subform? You need to call the subform to requery after the parameter values are updated so that it uses the new values in it's query.
 
This probably sounds dumb, but I cannot figure out how to up date the form after I have entered parameters, except by opening it up with a command button.
 
Check out the .requery method, placed in the AfterUpdate event code.
 
Last edited:
sorry to be redundant, but I still don't know where to place the requery command. The parameters are on the main form, and the info comes up in the sub-form. I haven't been able to requery the subform on an event in any of the main form fields. I have tried placing in all sorts of events on both sides, but still no luck. I'm sorry if these questions sound like a waist of time, but I cannot find a simple explanation anywhere.
 
There may be a better place for it, but in the OnChange event for each of your "parameter" text boxes put:
Code:
me.requery
me.refresh

This should update your subform anytime someone changes the contents of any of your parameter controls.

The OnChange event is going to trigger very frequently, though. A better place might be in the OnExit event, but that will mean your users will have to tab OUT of the control before your subform updates. Alternately, you could have a button on the form next to your parameter boxes that reads "Show Results" or something, and have the above code in the OnClick event of that button. Experiment a little to find the best tradeoff between ease of use and performanace.
 
WOW. That was beautiful. Worked like a charm, thank you so much. :D
 

Users who are viewing this thread

Back
Top Bottom