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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Recordsource

Status
Not open for further replies.

snorky

Programmer
Jun 5, 2001
58
GB
Dear All,
I have a form with a DataGrid on it which points to an invisible ADO control on my form .The ADO control RecordSource property points, initially, to a blank table in my Access db but during the program execution I want to look at other tables in the original database. I have tried changing the ADO control's RecordSource property and then re-showing the form with the datagrid on it but the grid is still blank (from the first table). How do I get the datagrid to show the data from the second and any other tables ? ? ?

Thanks...
 
Place this in your code after the line where you've changed the RecordSource...

Me.Requery
 
What does the Me. relate to, if I put that in the formload it tries to relate it to the form and errors. Is it the Datagrid or the ADO control that I'm requerying ? ie
frm_Main.ADCOC1.Requery ???
 
It is the form if you need to requery the ADO Control the code would be..Me is simply a dynamic way of returning the current form name.

Me.ADCOC1.Requery
 
Unfortunately that's not it. Requery isn't a method of a form and so errors .Which makes sense as the form isn't data-bound to anything . The grid and ADOcontol are - but it doesn't work if I requery either of them ???
 
FOUND IT ! What I need to do was add

frm_main.datagrid1.Refresh


Thanks anyway !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top