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!

Button to return a value from a Query: 1

Status
Not open for further replies.

brettatexplace

Technical User
Mar 8, 2002
60
CA
I would like to put a button on a form. When selected by the user, it would run a query of the database, adding values and arriving at a total. Then I want to assign the arrived at total to a variable on the form. Is there VBA to do this that I can put under the On_click of my button??

ex: value_is = query.CalculateIt.field_I_want
[myfield] = value_is

Is there something like this that would work?
 
Have a look at the DLookUp and/or DSum functions.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, those work great!!! The values are coming from a form that gets closed, putting me back at my original form that has the button. Can I get a new value, without the user haveing to select a button, by running my DSum in the "get focus"?? or is there a more appropriate spot?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top