Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    74

    Unanswered: Case of IF Statment in MS ACESS

    Hi guys help please...is it posible to convert this MS SQL stored procedure to MS ACCESS specifically the case statment under else statment..Thanks in advance!

    Code:
    CREATE PROCEDURE [dbo].[sp_User_Search]
    		@Search_Arg varchar(50),
    		@Search_By varchar(20)
    AS
    BEGIN
    		--SET @Search_Arg = '%' + @Search_Arg + '%'
    		IF @Search_by = 'Any'
    			BEGIN
    				SELECT User_ID, User_LoginName, User_FirstName, User_LastName, User_MiddleInitial, 
    					   User_Password, User_Type, User_DateCreated
    				FROM RCPS_UserAccount
    				WHERE (User_FirstName LIKE @Search_Arg) OR
                          (User_LastName LIKE @Search_Arg) OR
                          (User_MiddleInitial LIKE @Search_Arg) OR
                          (User_LoginName LIKE @Search_Arg)
    				ORDER BY User_LoginName
    			END
    		ELSE
    			BEGIN
    				SELECT User_ID, User_LoginName, User_FirstName, User_LastName, User_MiddleInitial,
    					   User_Password, User_Type, User_DateCreated
    				FROM RCPS_UserAccount 
    				WHERE 
    				CASE 
    					WHEN @Search_By = 'Username' THEN User_LoginName 		
    					WHEN @Search_By = 'Firstname' THEN User_FirstName
    					WHEN @Search_By = 'Lastname' THEN User_LastName
    					WHEN @Search_By = 'MiddleInitial' THEN User_MiddleInitial
    				END
    				LIKE @Search_Arg
    				ORDER BY User_LoginName
    			END
    END

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    OK assuming that what you mean is that you want to move a SQL server stored procedure into JET. Access isn't a database. JET doesnt' support anything remotely like procedures, so you will have to do the equivalent of that using a VBA function
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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