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!

Generic Query Designer

Status
Not open for further replies.

tb

Programmer
May 27, 2003
328
Hi all,

Can anyone tell me what I am doing wrong in this query?
(Generic Query Designer)

Basicaaly what I want to achieve is ...
When "ALL" Sales Rep name is selected it will only use Region as part of the WHERE clause otherwise it must use both the Region and Sales Rep selections in the WHERE clause of the Dataset query.

Any comments would be much appreciated.

="SELECT Region, CustName AS 'Customer Name', Custnmbr AS 'Customer Number', Contnbr AS 'Service Number', " &
" LastManifest AS 'Last Manifest Date', " &
" Datasheetnumber AS 'Datasheet Number', " &
" RateID AS 'Rate Number', ExpiryDate AS 'Expiry Date', " SLPRSNID, " &
" Cleanup_Permanent AS 'Service Type'" &
"FROM evs_LinkedDatasheetExpiry_Current " &
IIF (Parameters!Rep.Value = 0, "WHERE Region = " & Parameters!Region.Value & ", "WHERE Region = " & Parameters!Region.Value & " AND SLPRSNID = " & Parameters!Rep.Value & ")"

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
I got it to work.. I do appologise for the post.

Modified code:

="SELECT Region, custname AS 'Customer Name', Custnmbr AS 'Customer Number', contnbr AS 'Service Number', " &
" LastManifest AS 'Last Manifest Date', " & " Datasheetnumber AS 'Datasheet Number', " &
" rateid AS 'Rate Number', ExpiryDate AS 'Expiry Date', SLPRSNID, " &
" Cleanup_Permanent AS 'Service Type'" &
"FROM evs_LinkedDatasheetExpiry_Current " &
IIF (Parameters!Rep.Value = "0", "WHERE Region = '" & Parameters!Region.Value & "'" , "WHERE Region = '" & Parameters!Region.Value & "' AND SLPRSNID = '" & Parameters!Rep.Value & "'")

Cheers...

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top