Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subform doesn't get renewed after its query is rebuilt

Status
Not open for further replies.

SashaBuilder3

Programmer
Jan 13, 2002
129
CA
Hi everybody,


Here is what I have. My simple db contains just one table. I've created a form with a subform. The subform is based on a SELECT query and simply shows the table contents.

The main form has a few combo boxes from which a user can choose select criteria to filter data rows for the subform. Basically, when a certain value from a combo box is seleted the query gets programatically rebuilt and a new set of data rows is supposed to populate the subform. However, I don't know how to force the subform to show new data. The statement 'subForm.Requery' doesn't work. I also tried to add 'subForm.setFocus' before that, but it didn't help.

Any idea what should be done?



Thanks,

Alex
 
How are ya SashaBuilder3 . . . . .
SashaBuilder3 said:
[blue] Basically, when a certain value from a combo box is seleted [purple]the query gets programatically rebuilt[/purple] and a new set of data rows is supposed to populate the subform. However, I don't know how to [purple]force the subform to show new data[/purple].[/blue]
Apparently your not updating the [blue]RecordSource[/blue] of the subForm. If you did, the subform would automatically [blue]Requery![/blue]

Try Forms![purple]MainFormName[/purple]![purple]subFormName[/purple].Form.Requery

Post the code to show how your updating the Query/subForm and we can help you better . . . . .

Calvin.gif
See Ya! . . . . . .
 
Hi TheAceMan1,

Thanks for answering. The statement didn't work either, but that was my fault not posting the code. However you gave me an idea to check on RecordSource and the following line works just fine:

Me.frm_result.Form.RecordSource = strSQL

Another thing is that I don't have to create (or re-create) the query -- I just pass the query string (strSQL).

Thanks again!

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top