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

Variables don't work in spot where Hardcoded values do 1

Status
Not open for further replies.

thunderain

Programmer
Jan 10, 2002
40
CA
Hi

I have a fuzzy code dll for a fuzzy search. The dll is in vb, but my program is in asp/vbscript.
When i use this line to feed the dll, with hardcoded info, it works perfect:

s=objRS6.avfuzzyequiv("EntryLP","WNF180",4,"%")

This code gives me exactly the results I am looking for.

When i try to replace "EntryLP" and "WNF180" with variables for the fieldname and input all i get is errors.
I tried everything but here are a couple of examples:

s=objRS6.avfuzzyequiv( fieldname , value ,4,"%")

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'avfuzzyequiv'

s=objRS6.avfuzzyequiv & "(""" & fieldname & """,""" & value & """,4,""%"")"

Error Type:
Microsoft VBScript runtime (0x800A01C1)
Argument not optional: 'avfuzzyequiv'


Full code of working version with hardcoding:

dim objRS6
set objRS6=Server.Createobject("FuzzyQuery.AvFuzzyQuery")
s=objRS6.avfuzzyequiv("EntryLP","WNF180",4,"%")

Set objRS1 = objCon.Execute("SELECT SelectClause, viewID FROM tblSubCategory WHERE SubCategoryID=" & subcat )
strSQL = objRS1("SelectClause") & " AND " & s


If anyone can help me as to why this line will not take a varible, when hardcoded values work fine, it would be appreciated.

Thank you
thunderain
 
The variables aren't set properly.. You may want to ensure they are set to STRING by using a DIM statement..

ie.. DIM fieldname as STRING

or try ensuring its a string by using STR(fieldname)

On the otherhand.. for your second example with the quotes.. you're doing it all wrong..

s=objRS6.avfuzzyequiv & "(""" & fieldname & """,""" & value & """,4,""%"")"

should be:

s=objRS6.avfuzzyequiv ("" & fieldname & "","" & value & "",4,"%")

Hope this helps

Gorkem
 
Gorkem

thanks a mil

only you made me work a bit more, it was CStr, not STR
but you set me on the right track.

Here is the line that works perfect:

s=objRS6.avfuzzyequiv( CStr(fieldname) ,CStr(value),4,"%")

thunderain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top