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

Obtaining TextBox Values Via SQL

Status
Not open for further replies.

curlydog

Technical User
Aug 18, 2004
14
GB
I'm putting together a database that records overtime worked. The overtime can come from one of several budgets. I want to show how much has been added to each budget, and how much has been spent from the budget on a monthly basis.

The problem I have is that it may be the case that if no money is added to a budget in a particular month, there is no entry in the table recording additions which I can retreive.

I may have a solution but don't know if it will work, or how to do it. I have a table that stores the details of the budgets. If I set my reports record source to this table I can retreive the names of the various budgets (whether they have anything added or not) by placing a textbox in the detail section with it's control source set to the budget name.

I then plan to place a textbox alongside it and somehow get it to query the table recording additions and subtractions, based on the value of the textbox displaying the budget name. I'm using the SUM function so my query will only return one value.

Is this possible? I've tried setting the contol source of the textbox to an sql statement that will retreive the data I want but I keep getting #NAME? where my retreived data should be.
Any help appreciated
Thanks
Jason
 
the #Name? comes up when you're referrencing something which doesn't exsist or isn't recognised or you've just misspelt things...

as for the rest of your post, I'm not too clear on what you are asking...
presumably if there's no entry in a particular field, then there's nothing to be added, so just set that field to 0, not sure what the sum is about...

how's about trying to clarify just the bit that is giving you a problem, or exactly what you're trying to do...
 
Sorry if it wasn't explained too well. Basically I'm trying to find the sum of values and display them in a text box. I want the query to sum values based on the data in another text box. At the moment this is the SQL have as the controlSource of the textbox;

=(SELECT DSUM(hours) FROM [qryStatement] WHERE [opName]= & Reports.Reports1.Text0)

As both textboxes are in the detail section of the form, I'hoping the caluculated SUM value will change each time the value of my source textbox changes.

Hope this makes more sense.

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top