InDesign CS: Exit from script with cancel button not working

I have a script which open a selected file in Indesign CS after you enter the correct order number. This works as it should but if you click cancel it tells you it couldn’t find the order no, as I have this as the error handler in the try section. I been switching bits of this round all morning and I’m sure its pretty simple, but the solution escapes me. Could anyone take a quick look.

Thanks

Kieran


tell application "InDesign CS"
	activate
	set myDialog to make dialog
	tell myDialog
		set name to "Open Existing"
		set myDialogColumn to make dialog column
		tell myDialogColumn
			make static text with properties {static label:"Order No"}
		end tell
		set myDialogColumn to make dialog column
		tell myDialogColumn
			set myTextEditField to make text editbox with properties {min width:200}
		end tell
		show

-- basically I want you to be able to cancel the script here, clicking the cancel button from the dialog thats displayed, but doing this causes the next dialog in the on error handler to be displayed.

	end tell
	set orderNo to edit contents of myTextEditField
	set myFile to "publications:LIBRARY:" & orderNo
	destroy myDialog
	try
		alias myFile
		set myDocument to open myFile
	on error
		display dialog "Advert does not exist"
	end try
end tell

Try this:

tell application "InDesign CS"
	activate
	set myDialog to make dialog
	tell myDialog
		set name to "Open Existing"
		set myDialogColumn to make dialog column
		tell myDialogColumn
			make static text with properties {static label:"Order No"}
		end tell
		set myDialogColumn to make dialog column
		tell myDialogColumn
			set myTextEditField to make text editbox with properties {min width:200}
		end tell
	end tell
	set UserReturn to show myDialog
	if UserReturn is true then
		set orderNo to edit contents of myTextEditField
		set myFile to "publications:LIBRARY:" & orderNo
		destroy myDialog
		try
			alias myFile
			set myDocument to open myFile
		on error
			display dialog "Advert does not exist"
		end try
	end if
end tell

Thanks, thats working exactly how I wanted it now.

Cheers:D