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

Using a SQL query as the Control Source for a text box in a report 1

Status
Not open for further replies.

davidd31415

Programmer
Jan 25, 2006
154
US
Is it possible to use a SQL query as the Control Source for a text box in a report?

The table I am reporting, "Transactions," has a field "TestRequestID," which I am grouping by. I would like to display the TestRequestNumber (stored in the table "TestRequests") on the report.

I've tried entering this into the Control Source:

=SELECT TestRequestNumber FROM TestRequests WHERE TestRequests.TestRequestID = Transactions.TestRequestID

but I get the error "The syntax of the subquery in this expression is incorrect."

I've tried a few other syntaxes but always end up with the same error message.

Am I approaching this problem the wrong way?
 
You need DlookUp

[tt]=DlookUp("TestRequestNumber","TestRequests","TestRequestID = " & TestRequestID)[/tt]

Assuming that TestRequestID is numeric.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top