Data from a form to use in an Stored procedure

G

Guest

I have a form I 've created on an .adp I need to be able to take the data off
the form and use as parameters in a stored procedure to add the info to a
table. The procedure is:
CREATE PROCEDURE dbo.scNoteInsert
@review_date datetime,
@employee_id int,
@result_code varchar(10),
@reviewer_name varchar(30),
@review_notes text
AS
INSERT dbo.tbl_hr_performance (review_date, employee_id, type_code,
result_code, reviewer_name, review_notes, time_stamp, [user_id])
VALUES (@review_date, @employee_id, 'NOTES', @result_code, @reviewer_name,
@review_notes, GETDATE(), USER_NAME())

GO
How to I get the info off the form and into the procedure?
I have put a cmd button on the form to run the procedure but it asks me for
the parameters.
 
S

Sylvain Lafontaine

The newsgroup for ADP is m.p.a.adp.sqlserver.

In your case, you can either create a sql string with the word EXEC at the
beginning and the values of the parameters at the end to call your SP (using
CurrentProject.Connection.Execute for example) or build an ADO Command
object with all the parameters and use the CurrentProject.Connection as the
connection of your command object. All of this is standard manipulation of
ADO objects; with the detail that you will usually use
CurrentProject.Connection as your main connection object to the SQL-Server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top