Subform not showing data on main form

P

Peter D

Please help,

I have a main form which uses unbound controls where a user can enter a from
and to date value as parameters for a query.
A subform then uses these two controls values in the query to retrieve the
data contained between the given date range.

After the user changes the values in the main form's date text boxes the
subform is meant to then requery the data and update the datasheet recordset
it displays. But it shows NO data at all :(

The code i'm using after the date text fields are updated to requery the
subform's recordset is;
Private Sub txtDateFrom_AfterUpdate()
Me.Show_monthly_totals_SUB.Form.Requery
Me.Show_monthly_totals_SUB.Form.Refresh
Me.Show_monthly_totals_SUB.Requery
Me.Refresh

End sub

I have tried an assortment of requery/refreshing but the subform just
refuses to show any data, I must be missing something.

The subform references the following query and I know the query works
because if its ran while the main form is open it shows the correct data.
query sql for reference is:
SELECT tblAccounts.dateOfPayment, Sum(tblAccounts.MRPpayment) AS
SumOfMRPpayment, Sum(tblAccounts.MRPgstamount) AS SumOfMRPgstamount,
([SumOfMRPpayment]-[sumofMrpgstamount])*0.8006 AS AccountA,
([SumOfMRPpayment]-[ACCOUNTA]) AS AccountB, Max(tbl_clients.ALPS2ID) AS
MaxOfALPS2ID
FROM tbl_clients LEFT JOIN tblAccounts ON tbl_clients.client_id =
tblAccounts.clientID
GROUP BY tblAccounts.dateOfPayment
HAVING (((tblAccounts.dateOfPayment) Between [forms]![show monthly
totals]![txtDateFrom] And [forms]![show monthly totals]![txtDateto]) AND
((Max(tbl_clients.ALPS2ID))<>""));

thanks in advance
Peter.
 
P

Peter D

can someone please help?
To summarise how do i get a subform to refresh itself after I change its
underlying recordsource which uses date parameters from controls on its
parent (main) form?
 

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

Top