Subform data

M

Mat

Hello

I have a form that has a subform with Child and Master fields linking
the data.

The data source for the subform is a query.

I have a button on the master form that changes the query to show
different data (I.E. all data for a company or a selection of data), as
follows :

************************* On click event for toggle button

If Me.change_btn = 0 Then
strSQL = "SELECT invoices.ID, invoices.company FROM
invoices;"
qdf.SQL = strSQL
Forms!company!invoices_subform.Requery
Else
strSQL = "SELECT invoices.ID, invoices.company FROM invoices
WHERE (((invoices.paid) Is Null));"
qdf.SQL = strSQL
Forms!company!invoices_subform.Requery
End If

*************************

The strSQL updates the query no problem, but the updated query is not
being displayed in the subform untill I close the form and re-open it.

The question is, how do I requery, refresh or rewhatever the subform in
order to show the correct data.


Thanks in advance

Mat
 
S

Sirocco

Try throwing in a Refresh after the last Requery. The refresh may even need
to be in a different event procedure than the Requery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top