View Full Version : Refreshing subform within form


BigJimSlade
10-11-2000, 06:42 AM
I have a subform that is not bound to my form. However, the subform's source object is a query that is executed by my form combo box. I would like to refresh the subform while still in form view. I tried .requery for the subform, but it did not work. What should I do?

Jim

chrismcbride
10-11-2000, 08:36 AM
On the AfterUpdate of the combo box you could try...
Forms!FormName!SubFormName.Refresh
Chris

mghdb
10-11-2000, 09:54 AM
I had the same problem with my form and one of the helpful souls here suggested I use

Me.Requery in the AfterUpdate property

It worked in my case, hope it works for you.

BigJimSlade
10-11-2000, 10:24 AM
Hey Chris!

Thankyou for the advice, but it did not work. What could be preventing my subform from showing the current query? If I close out and reopen the form, the data is accurate.

Thanks again, Jim

[This message has been edited by BigJimSlade (edited 10-11-2000).]

chrismcbride
10-11-2000, 04:33 PM
BigJim (if that really is your name)
I don't have a lot of experience with unbound sub forms, however you might try to put the name of your combo box in the criteria line of the matching field of the Query. Say your sub form displayed employee information. The Query might be selecting fields like emp_no, emp_name, emp_address etc. The Combo box on your form would have a SELECT query as it's recordsource that Selected emp_nos and Emp_names but only displayed the names. In the emp_no field of the query you would have a criteria of ...
=[Forms]![FormName]![ComboBoxName]
Then you go ahead with the call to requery or refresh the subform (either should work). Thereby the Query is called using the current value of the Combo Box.
I think that should work
Chris

David Cochrane
10-11-2000, 08:00 PM
If the subform and main form have the same field i.e. your combo box pulls up a value that is shown in the subform you could then (I think) click on the subform and link child to Master.

I'm very inexperienced at this game but managed to achieve what you are after by doing just that.

Hope if helps

BigJimSlade
10-13-2000, 07:48 AM
I wanted to thank everyone for their suggestions. You have all been a great help.

Big Thanks from Big Jim!