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

Problems writing a function

Status
Not open for further replies.

cyberprof

Programmer
Jun 10, 2003
229
0
0
GB
I'm trying to write a function to place in a loop

I want to pass a date through the function to return a true or false value

This is what I have so far..

------------------------
Do until rst.EoF
dte = rst("Date")

IF TSExists(Dte) = "True" THEN
Do this
ELSE
Do this
END IF

rst.movenext
LOOP
------------------------

<% Function TSExists(Dte)

TSExists = "False"
pass 'dte' through a query
If recordcount <> 0 Then TSExists = "True"

END Function %>

When I run the page I receive this error:

Type mismatch: 'TSExists'

Any help will be appreciated

J



 
Does the same thing happen when you pass a static value (not a request form/querystring) into the function?

Pass a date you know exists into the function and lets see what happens..
 
I would lose the quotes on ALL references and make TSExists totally boolean:

TSExists = False

or

TSExists = True



 
There should always be a value in 'dte', but I will try.
 
OK, I've changed it totally boolean and I passed a manual date through the function TSExists("12/01/05"), but still the same error.
 
This might seem wierd, but I've been trying a few different options and I've got it working just be changing TSExists to TSE

Doesn't make sense!!!
 
Not to my knowledge. Don't think it'd make a difference, according to the code above you dont have exists anywhere unless there is "TS" in front of it.

Let's see your actual code with the query in the function, etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top