View Full Version : Data in controls and same data in Datasheet view also. Subform not updating. !! HELP


hallian92
05-08-2002, 05:27 PM
Hi,
I am trying to figure out how to do this.

I have a Form that has different controls i.e. TextBoxes, ComboBoxes, Labels etc and it is my Main Form also. The value in the controls are filled by running a Query and with NavigationButtons can Navigate through the data i.e. Record Source Property of my Main Form is set to a Query. Lets's say I get 15 records when the Form pops-up and the first record is shown in the controls by default, to get to different record can use the NavigationButtons.

Now what I also want is that to show the same result in a Dataseet view also so that the user can see all the records at one time also. So for this I have a subform whose Record Source Property is also set to the same Query that's set to Main Form and I have added this subform to my Main Form. Now when my Form pops-up it shows all the records in a subform Datasheet and also the individual records in the controls of my Main Form and can use NavigationButtons to move to different record. On my my Main Form I also have a button that when clicked searches a table against any value the user selects in the Main Form control and returns the result e.g. it returns 5 records so my controls in my Main Form are updated and the NavigationButtons show 5 and can move arround. But my subform doesn't show those five records returned by search. How can I update my subform also.

In my buttons clicked event I get the value of the selected control and wrote a SQL statement and create a query and now I assign the Record Source property of my Main Form to this new query to filter through the results. Now I want to assign the same query to my subform also so that I get the same records and show them in the subform Datasheet view. I think I can't assign a Record Source property of my subform to this new query now because it only have Source Object property. How can I show the filtered records in my subform also. Filtering is only done on the Main Form's controls and my subform is there only to show the results in a Datasheet view and I also don't show the NavigationButtons for the subform as it is a Datasheet with scrolls. Is there any way I can change the Record Source Property of my subform to some other Query in my Main Form

I'll really appreciate for any help.
Thanks.