Refresh/Requery Subforms

Shallo9

Registered User.
Local time
Yesterday, 17:18
Joined
Nov 11, 2011
Messages
95
Hello All,

Could anyone please help with the following.

I've got a datasheet view form and got a couple of Subforms in a separate Tab Control (Ofcourse on different tab pages).

All these three forms (The Datasheet view form and the two subforms) have a Customer ID in common.

I want to refresh/requery the subforms in the tab pages every time i select a row in the datasheet view form depending upon the customer ID.

NB: the subforms display the data retrieved from a query.

Any sort of help would be appreciated.

Many Thanks
 
Yo!

I've managed to get this work. However may be not the most efficient way but still works fine for me....Just felt to share it just in case...

Dim X as Integer

Code in the form_load of the main form
{
X=1
Forms!MainForm.SubForm.Form.RecordSource="Select * from tblCustomer"
}

Code in Form_Current of the main form
{
If X>1 then
Forms!MainForm.SubForm.Form.RecordSource="Select * from tblCustomer where (tblCustomer.customerID)=" & Me.CustomerID
Else
X=2
End If

Note: This code failed for the very first instance, may be B'Coz of the order of events triggered. Some how I wanted to stop the execution of Form_Current at the very first instance So I've added the code in red.

Hope that makes sense.
 

Users who are viewing this thread

Back
Top Bottom