OK, first here is the code:

sqlcmd = "SELECT space_available, ministry_id, pricing_id, min_group,
max_group FROM tbl_event WHERE event_id = " + int_event + " AND (event_year
= DATEPART(YYYY,GetDate()) OR event_year = (DATEPART(YYYY,GetDate()+1)))"
set rs = conn.Execute(sqlcmd)

IF rs("pricing_id") = 0 THEN
bln_group = "false"
ELSEIF rs("pricing_id") <> 0 THEN
bln_group = "true"
END IF

'This is the IF stmt that is giving me the problems
IF num_spaces > rs("space_available") THEN
bln_space = "false"
ELSEIF num_spaces < rs("space_available") THEN
bln_space = "true"
END IF

So, I am passing form data to this form, then doing a compare on some of the
values. I pull from the database the total number of spaces available for
the specified event and then compare that to the number of people they want
to send to the event to determine if there is space available. I know this
doesn't take into account if there are already registrations, that is the
next step, but for now the compare is failing. When I write out the values,
I get that the num_spaces is right, let's say 12 and the
rs("space_available") is right, 225, but the compare is wrong, it resolves
to bln_space="false". Now, I have been working on isolating this problem for
like 18 hours (pathetic, I know), so perhaps some fresh eyes/minds can see
where I have gone astray? Any input would be most appreciated.

Willie

Re: Dim stmt by Tom

Tom
Fri Jul 07 14:34:31 CDT 2006

My guess is that this is a type mismatch problem the left side of the
compare is probably a numeric type and the right side is probably a
string. Try forcing both to be compared as a uniform type, as in ...

IF CLng(num_spaces) > CLng(rs("space_available")) THEN

Tom Lavedas
=============
http://members.cox.net/tglbatch/wsh

Willie Bodger wrote:
> OK, first here is the code:
>
> sqlcmd = "SELECT space_available, ministry_id, pricing_id, min_group,
> max_group FROM tbl_event WHERE event_id = " + int_event + " AND (event_year
> = DATEPART(YYYY,GetDate()) OR event_year = (DATEPART(YYYY,GetDate()+1)))"
> set rs = conn.Execute(sqlcmd)
>
> IF rs("pricing_id") = 0 THEN
> bln_group = "false"
> ELSEIF rs("pricing_id") <> 0 THEN
> bln_group = "true"
> END IF
>
> 'This is the IF stmt that is giving me the problems
> IF num_spaces > rs("space_available") THEN
> bln_space = "false"
> ELSEIF num_spaces < rs("space_available") THEN
> bln_space = "true"
> END IF
>
> So, I am passing form data to this form, then doing a compare on some of the
> values. I pull from the database the total number of spaces available for
> the specified event and then compare that to the number of people they want
> to send to the event to determine if there is space available. I know this
> doesn't take into account if there are already registrations, that is the
> next step, but for now the compare is failing. When I write out the values,
> I get that the num_spaces is right, let's say 12 and the
> rs("space_available") is right, 225, but the compare is wrong, it resolves
> to bln_space="false". Now, I have been working on isolating this problem for
> like 18 hours (pathetic, I know), so perhaps some fresh eyes/minds can see
> where I have gone astray? Any input would be most appreciated.
>
> Willie


Re: Dim stmt by Willie

Willie
Fri Jul 07 14:48:59 CDT 2006

Yes, that was what I was thinking and couldn't come up with the function.
Thank you very much, that did it!

Willie

"Tom Lavedas" <tglbatch@cox.net> wrote in message
news:1152300871.344540.267310@35g2000cwc.googlegroups.com...
> My guess is that this is a type mismatch problem the left side of the
> compare is probably a numeric type and the right side is probably a
> string. Try forcing both to be compared as a uniform type, as in ...
>
> IF CLng(num_spaces) > CLng(rs("space_available")) THEN
>
> Tom Lavedas
> =============
> http://members.cox.net/tglbatch/wsh
>
> Willie Bodger wrote:
>> OK, first here is the code:
>>
>> sqlcmd = "SELECT space_available, ministry_id, pricing_id, min_group,
>> max_group FROM tbl_event WHERE event_id = " + int_event + " AND
>> (event_year
>> = DATEPART(YYYY,GetDate()) OR event_year = (DATEPART(YYYY,GetDate()+1)))"
>> set rs = conn.Execute(sqlcmd)
>>
>> IF rs("pricing_id") = 0 THEN
>> bln_group = "false"
>> ELSEIF rs("pricing_id") <> 0 THEN
>> bln_group = "true"
>> END IF
>>
>> 'This is the IF stmt that is giving me the problems
>> IF num_spaces > rs("space_available") THEN
>> bln_space = "false"
>> ELSEIF num_spaces < rs("space_available") THEN
>> bln_space = "true"
>> END IF
>>
>> So, I am passing form data to this form, then doing a compare on some of
>> the
>> values. I pull from the database the total number of spaces available for
>> the specified event and then compare that to the number of people they
>> want
>> to send to the event to determine if there is space available. I know
>> this
>> doesn't take into account if there are already registrations, that is the
>> next step, but for now the compare is failing. When I write out the
>> values,
>> I get that the num_spaces is right, let's say 12 and the
>> rs("space_available") is right, 225, but the compare is wrong, it
>> resolves
>> to bln_space="false". Now, I have been working on isolating this problem
>> for
>> like 18 hours (pathetic, I know), so perhaps some fresh eyes/minds can
>> see
>> where I have gone astray? Any input would be most appreciated.
>>
>> Willie
>