Hi folks,
I've upgraded MS-Access 2002 to a MS-Access Project (adp), so now I have to
deal with more sophisticated queries (may I call them so?) like stored
procedures. I have a form with a combobox for selections and a textbox to
enter a certain value. Let us say I call the combobox @select and the
textbox @find. The combobox always shows the first of the items to select.
Now I want to return a message if nothing is found, or if nothing has been
entered at all. The stored procedure reads for instance:
ALTER PROCEDURE OPC
@select nvarchar(20), @find nvarchar (100)
AS
SET NOCOUNT ON
IF
@find IS NULL
BEGIN
PRINT 'You didn't enter any value'
RETURN
END
IF
@select = 'Author'
BEGIN
SELECT *
FROM Books
WHERE Author LIKE '%' + @find + '%'
ORDER BY Author, Title, Publisher, Year
END
[And so on]
RETURN
This works correct when I enter something, but when I don't enter any value,
a message box pops up saying that the stored procedure has been executed,
but no records were found. I want to see an error message like above. It's
as simple as
ALTER PROCEDURE Hello
AS
BEGIN
PRINT 'Hello'
END
and nothing is seen. Does anybody know? Thank you.
Wim