Code treats correct entry as incorrect - Why?

The following is a part of a script which asks the user to input a number then to input another number.
The second number must be twice the value of the first.

This works fine until the second number is more than 9 (i.e. 2 numerals 1 & 1 for 11 etc)

Can anyone explain?

Thanks in advance

[code]tell application “Finder”
display dialog “Enter No. of Accom Codes” default answer “” buttons {“OK”} default button 1
set accomCode to the text returned of the result
set checkIt to false
repeat while checkIt is false
display dialog “Enter Total Rows of Prices” default answer “” & accomCode * 2 & “” buttons {“OK”} default button 1
set totRows to the text returned of the result

	-- check totRows is 2* accomCode
	if totRows < accomCode * 2 then
		display dialog "Total Rows of Prices must be

at least 2 times the Accom Code!
(in a few exceptions, e.g. twin centres and island
hopping, the pagination will show total rows = to
No. of Accom codes. If this is the case please
enter 2x accom code in total rows!)" buttons {“Cancel”, “OK”} default button 2
else
if totRows ≥ accomCode * 2 then
set checkIt to true
end if
end if
end repeat
end tell[/code]

Hi,

the problem is, your do your math with strings, not with numbers
This should solve the problem


.
set accomCode to the text returned of the result as integer
.
set totRows to the text returned of the result as integer
.

Many, many thanks Stefan!

it’s simple when you know how!!

Steve