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

Union Query - how to add prompts for fields 1

Status
Not open for further replies.

bmoberly8888

Technical User
Nov 18, 2004
26
US
I have a union query for 2 queries - Billed Fees and Unbilled Fees. However I want to put a prompt in for a client number and one for a matter number. I'm sure I need to add WHERE... - but am not sure of the syntax. My fields are CliCode and MatNbr - and I want a prompt "Enter client number" and "Enter matter number".
 
WHERE CliCode = [Enter Client Number] AND MatNbr = [Enter Matter Number]

alternatively, build a form that allows the user to enter this information with a button that runs the query and use:

WHERE CliCode = Forms!FormName!ClientIDControl AND MatNbr = Forms!FormName!MatterNbrControl


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
Do I need parentheses anywhere? I put in that code - but after I put in the client number and matter number I got an error that said ODBC - call failed. I'm not sure what's wrong. Thanks.
 
Here is the SQL - thanks for your help.

SELECT [WrkTmkpr], [CliCode], [MatNbr], [CliReportingName], [MatReportingName], [Date], [Hours], [Rate], [Amount], [Narrative]
from [WORKED_TIME_BILLED_WITH_NARRATIVE] WHERE CliCode = [Enter Client Number] AND MatNbr = [Enter Matter Number]

UNION ALL SELECT [WrkTmkpr], [CliCode], [MatNbr], [CliReportingName], [MatReportingName], [Date], [Hours], [Rate], [Amount], [Narrative]
from [WORKED_TIME_UNBILLED_WITH_NARRATIVE];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top