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

boolian should test true

Status
Not open for further replies.

jcroft

Programmer
Aug 23, 2001
52
US
this page is to verify that user has access to certain inventory...
the comma delimited memo field "AllAccessusers" contains the name "ADMIN" which is my test user...but the boolian did not change to true...what have I done wrong???

THANK YOU. JB

<%@ Language=VBScript %>
<%ID = Request.QueryString(&quot;ID&quot;)
name = Request.QueryString(&quot;name&quot;)
Response.Write ID & &quot;J&quot; & name & &quot;B&quot;

con1 = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;password.MDB&quot;)
set rs1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strSQL1 = &quot;SELECT * FROM AuthorizedUsers WHERE suitenumber=&quot; & ID
rs1.Open strSQL1, con1,1,3

IF rs1.EOF = true then
Response.Write &quot;We have no suitenumber & ID in our database at this time.&quot;
%><a href=&quot;javascript:history.back()&quot;>Back</a><%
END IF
DIM QCMarray()
DIM VSGarray()
DIM Allarray()
DIM bool
IF rs1.EOF = false then
SUB find_name
bool = false
split(rs1(&quot;QCMusers,','&quot;))
split(rs1(&quot;VSGusers,','&quot;))
split(rs1(&quot;AllAccessusers,','&quot;))
FOR i = 0 to len(QCMarray)
IF name = QMCarray(i) then
bool = true
EXIT SUB
END IF
NEXT
FOR i = 0 to len(VSGarray)
IF name = VSGarray(i) then
bool = true
EXIT SUB
END IF
NEXT
FOR i = 0 to len(Allarray)
IF name = Allarray(i) then
bool = true
EXIT SUB
END IF
NEXT
END SUB
IF bool = true then Response.Redirect ID & &quot;index.asp&quot;
IF bool = false then
Response.Write &quot;The user '&quot; & name & &quot; is not Approved for this suite at this time.&quot; & &quot;'&quot;
%><BR><a href=&quot;javascript:history.back()&quot;>Back</a><%
END IF
END IF

rs1.Close
set strSQL1 = nothing
set con1 = nothing
Response.End
--only those that do not try, fail--
 
jcroft,

I ran into this problem before. After yoy use the SPLIT function, you need to TRIM the results as there are spaces in the results.


Cheers,
fengshu_1998

 
I trim the variables, it didn't make any difference,
I Ucase them, it didn't make any difference..

like this......

FOR i = 0 to len(Allarray)
IF trim(ucase(name)) = trim(ucase(Allarray(i))) then
bool = true
EXIT SUB
END IF
NEXT

did I do it correctly??

JB
--only those that do not try, fail--
 
It's not even getting into your find_name subroutine, because you never call it:
IF rs1.EOF = false then
SUB find_name

you need to:

IF rs1.EOF = false then
find_name

then I'd move your subroutine out of there, to remove the clutter from your If clauses....
And since it never got into that code, it never hit on these errors:

chg
split(rs1(&quot;QCMusers,','&quot;))
split(rs1(&quot;VSGusers,','&quot;))
split(rs1(&quot;AllAccessusers,','&quot;))

to:
QCMarray = split(rs1(&quot;QCMusers,','&quot;))
VSGarray = split(rs1(&quot;VSGusers,','&quot;))
Allarray = split(rs1(&quot;AllAccessusers,','&quot;))


and

FOR i = 0 to UBound(QCMarray)
....
(using len(QCMarray) will go 1 beyond the offset of the array)

FOR i = 0 to UBound(VSGarray)
....

FOR i = 0 to UBound(Allarray)
....

I'd also use
If NOT rs1.EOF Then (may be the same thing, I just think it looks cleaner)

And move your bool = false statement outside of your subroutine and If clause, up above, just below dim bool.

Then you can start addressing any other errors that might pop up.... B-)
 
i just looked at it again... your &quot;splits&quot; should be syntaxed as such:

QCMarray = split(rs1(&quot;QCMusers&quot;),&quot;,&quot;)
VSGarray = split(rs1(&quot;VSGusers&quot;),&quot;,&quot;)
Allarray = split(rs1(&quot;AllAccessusers&quot;),&quot;,&quot;)
 
Thank you Lobstah,

your patience is appreciated.

JB
--only those that do not try, fail--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top