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

Change Record Source query for a Form

Status
Not open for further replies.

KavJack

Programmer
Apr 1, 2001
46
I have a Form based on a Query which generates the following fields: Year, Count for Round1,Count for Round2,Count for Round3,Count for Round4,Count for Round5.
Most years the Count for Round5 is going to be zero.
This Form has a Default View of Continuous Forms so that I can see the output as a series of rows from the year 1926 up to the current year 2002. I have added a button at the footnote to the form. When I click on this button I want the above data to be replaced by the results of another query which has the following fields: Year,Team, Count for Round1,Count for Round2,Count for Round3,Count for Round4,Count for Round5 where the Count for Round5 is equal to 1. This would generate 5 records which I want to display with a Default View of Continuous Forms. Any ideas on how to achieve this ?
 
I am not sure what you are trying to accomplish here. To change a forms recordsource you simply could put this on the OnClick event of the button:
Me.Recordsource= "TableName" or "QueryName" or "Select statement"

If the field names are different per recordsource then you it won't work. For it to work in this simple way then the fields need to have the same names.

It sounds like what you might need is another form. Seems to me a form with a TabControl. Each with a seperate Subform with the data you want to show.

Please explain more so I understand more of what you are after. Remember the Past, Plan for the Future, yet Live in the Now for tomorrow may never come.
-etrain
 
Thanks for your reply.
I tried the setting Me.Recordsource but got an error message. The fields for both queries are the same except that second query has the extra field "Team" in it. I was hoping that I could use the same form with a blank Team name for the first query. That way the Form could be built to handle both queries. Basically the second query is examining the same data as the first query just removing all those records with Count for Round5 equal to zero.
If I haven't explained this sufficiently, maybe I could e*mail you the form and a small database ?
My e*mail is kavjack@swbell.net.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top