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!

Problem with a simple 'IF' statement!

Status
Not open for further replies.

SmileyFace

Programmer
Sep 10, 2002
99
US
I need help!! This isn't making sense! I am trying to use an 'If' statement to open a report and it won't work....if I write the same code without the 'If' it works fine....here is what works.....the following code passes an ordernum=soeno to a report called soa.rpt.

ReportName = Request.QueryString("ReportName") & ".rpt"
if Request.QueryString("Debug") = "Y" then
Response.Write &quot;ReportName = &quot; & ReportName & &quot;<BR>&quot; & vbcrlf
session(&quot;debug&quot;)=&quot;Y&quot;
end If

OrderNum = Request.QueryString(&quot;soeno&quot;)
SelectionFormula = &quot;{soa_header.soeno}= '&quot; & OrderNum & &quot;'&quot;
session(&quot;oRpt&quot;).RecordSelectionFormula = cstr(SelectionFormula)
if Request.QueryString(&quot;Debug&quot;) = &quot;Y&quot; then
Response.Write &quot;SelectionFormula = &quot; & SelectionFormula & &quot;<BR>&quot; & vbcrlf
end If


Just to test it with an 'If' statement so I could add an else later for use with another report, I tried the following code....basically just added an if-then statement to the same part...and an else end if it doesn't hit the if statement. Here is what it looks like....

ReportName = Request.QueryString(&quot;ReportName&quot;) & &quot;.rpt&quot;
if Request.QueryString(&quot;Debug&quot;) = &quot;Y&quot; then
Response.Write &quot;ReportName = &quot; & ReportName & &quot;<BR>&quot; & vbcrlf
session(&quot;debug&quot;)=&quot;Y&quot;
end If

OrderNum = Request.QueryString(&quot;soeno&quot;)

If Reportname = &quot;soa.rpt&quot; then
SelectionFormula = &quot;{soa_header.soeno}= '&quot; & OrderNum & &quot;'&quot;
session(&quot;oRpt&quot;).RecordSelectionFormula = cstr(SelectionFormula)
else
response.end
end if


if Request.QueryString(&quot;Debug&quot;) = &quot;Y&quot; then
Response.Write &quot;SelectionFormula = &quot; & SelectionFormula & &quot;<BR>&quot; & vbcrlf
end If

Basically the first code above works fine but the minute I add the 'If' statement it just goes to the else part and ends it. PLEASE HELP! I am getting real confused! I am sure its a problem with the if ReportName = &quot;soa.rpt&quot; then statement but cannot figure out what!! THANKS.
 
What are you getting from your querystring? Is it coming over the way you expect?
for each objItem in request.querystring()
response.write(objItem & &quot; = &quot; & request.querystring(objItem) & &quot;<br>&quot;)
Next
 
IF blah1............THEN
do it
ELSEIF blah2........THEN
do something else
ENDIF
ENDIF

> need more info?
:: don't click HERE ::
 
recommendations

1) give a variable the value of the querystring
eg:
Dim valPassed
valPassed = Request.QueryString(&quot;Debug&quot;)

2) test it
Response.Write valPassed

value there?

then test all the session var's after and everything else that gets value form the script. that usually gives away the error

_____________________________________________________________________
Please help! I'm falling asleep over here!
onpnt2.gif

 
Hey guys! Thanks for all the help. But I tried using the trim(lcase()) and it worked. Here is what I used....

dim Report
Report = trim(lcase(Request.QueryString(&quot;ReportName&quot;))) & &quot;.rpt&quot;

The IF statement worked fine after that.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top