Results 1 to 1 of 1

Thread: Print Statement in Stored Procedure doesn't pop up

  1. #1
    Join Date
    Jul 2004
    Location
    The Hague, Netherlands
    Posts
    1

    Print Statement in Stored Procedure doesn't pop up

    Hello friends,

    I've upgraded MS-Access 2002 to a MS-Access Project (adp), so now I have to deal with more sophisticated queries like (may I call them so?) 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

    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
    Last edited by wvanrosm; 07-27-2004 at 03:06 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •