PDA

View Full Version : incorrect data type


ABC123

John Haytko
09-13-2004, 08:30 PM
trying to count the number of records in a web component dialog and use for validation. Here is what I am using. I have tried even seeting recn = "5" and still get incorrect data type.

dim member as n
dim recn as n
member = lookup("members", "user_name = \""+session.user_name+"\"", "member_id")
recn = tablecount("items","member_id = 'member'")
if recn "= "5"
currentform.has_error = .t.
currentform.error_message = "Your max items have been reached."

Selwyn Rabins
09-13-2004, 08:56 PM
tablecount() returns a numeric value. so recn is a numeric variable

your script tests a character value:

if recn "= "5"

John Haytko
09-14-2004, 05:44 PM
How do I make 5 numeric? Am I going about this all wrong?

Selwyn Rabins
09-14-2004, 06:02 PM
5 is numeric. "5" is character.

you just need to change

if recn "= "5"


to

if recn "= 5