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

Getting Calculation into Form 1

Status
Not open for further replies.

Zandor435

Technical User
Jan 23, 2003
70
US
I ran a querry from my main table, and did a calculation in it. I also made a form for my table, and want to put the calculated result from my query into the form, but don't know how to do it. Is there a way to get the information into the form from the query, or is the only way I can get the calculation in the form, is to do the calculation in the form itself? (The reason I want to get the information from the query is I want to reference to many forms/reports). Thanks.

Z
 
You can make the form's recordsource the query rather than the table.

When creating the query with the calculated field, drag the '*' down into 'Field:'

then add your column with the calculation.

You will then be able to use the query as your form's recordsource and add/edit/delete just as if it were the table.
 
Okay....Now, I have a couple of other questions. First, I have made a form, and it's the way I want it. Can I just change the source of my current form (which gets it's data from the table) to come from the querry? If so, how? Or do I have to make a whole new form again? Also, with this table to querry to form format, if I update things in my form will it update it in the querry and the table? Thanks.

Z
 
As long as you haven't mucked around with the names of your fields, you can simply change the record source property of the FORM to use your query.

(Many purists recommend that all forms be based on QUERIES anyway, so you may as well start to form good habits early on).

If the query returns an updateable recordset (no GROUPING-BY guys or sums or anything, then) your changes on the form will be passed through to the actual underlying table.

Also, just so you'll know, the act of opening the form will cause the query to be 'run' automatically. But if another user, for example, changes the table data directly, you may need/want to "requery" the form to refresh it, and get the new table data. Look up REQUERY and REFRESH in help to get more details.

Try it, you'll like it.

Jim


Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Sounds good....that's what I thought, but I can't find where you change the control source. (This is an embarassing quesiton, I know) I click on properties, but cannot find it. I see tag, but I don't see anything that refereces a my table or anything. Am I not looking in the right place?

Z
 
Nevermind, I found it. Thanks for all your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top