How get value from query into a textbox ???

R

Rebecca

I have a text box that needs to get the value from a query which uses another textbox value on the screen.
Here is the query

SELECT sum(Activity.ActivityHours) AS ActivityHour
FROM ChangeRequest, Assignment, Activit
WHERE ChangeRequest.ID = Assignment.ChangeRequestID an
Assignment.ID = Activity.AssignmentID AND ChangeRequest.ID = [Reports]![rptISRReport]![txtID]

I need to get ActivityHours into my text box. I've tried many things and have been stuck on this for the entire day. Please help!
 
V

Van T. Dinh

Set the ControlSource of the TextBox to:

= DLookUp("ActivityHours", "QueryName")

(including the equal sign).

Perhaps you should re-design your Query using Joins to make it a bit more
efficient rather than the Cartesian Joins, i.e. no Joins at all.

--
HTH
Van T. Dinh
MVP (Access)



Rebecca said:
I have a text box that needs to get the value from a query which uses
another textbox value on the screen.
Here is the query:

SELECT sum(Activity.ActivityHours) AS ActivityHours
FROM ChangeRequest, Assignment, Activity
WHERE ChangeRequest.ID = Assignment.ChangeRequestID and
Assignment.ID = Activity.AssignmentID AND ChangeRequest.ID = [Reports]![rptISRReport]![txtID];

I need to get ActivityHours into my text box. I've tried many things and
have been stuck on this for the entire day. Please help!
 
Top