April 30, 2009 at 1:46 pm
Hi,
I'm relatively new to SQL. I have a Access frontend with a SQL 2000 backend. I created a stored procedure which will be executed from a form. The stored procedure adds records to a table.
Here is the sp:
ALTER PROCEDURE spCat1
(
@appointment_time smalldatetime,
@snidint
)
AS
BEGIN
INSERT INTO tblSHSClinicTreatments (Treatment, Price, Date, SNID)
SELECT tblPackages.PackageComponent, tblPackages.PackagePrice, @appointment_time, @snid
FROM tblPackages
WHERE tblPackages.PackageNumber = 'C1'
END
RETURN
Here is the code behind the command button on my form:
CurrentProject.Connection.Execute "EXEC spCat1 " Forms!frmSpayNeuterClinic!ApptDate & Forms!frmSpayNeuterClinic!SNID
I can get this to work if I supply a date but when I try to get the date from a field on the form (like I do the SNID field) it doesn't work. I think my syntax is all screwed up.
Any help would be greatly appreciated.
Thanks
Lisa
April 30, 2009 at 2:59 pm
I am pretty sure that this is an Access problem and not a SQL Server one. You might have more luck if you moved this to the Access forum.
Anyway, questions:
1) what is the error that you are getting?
2) What does your code-behind look like when you "supply a date"?
3) hmmm, try just taking the "&" out of the code-behind?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
April 30, 2009 at 3:00 pm
RBarryYoung (4/30/2009)
I am pretty sure that this is an Access problem and not a SQL Server one. You might have more luck if you moved this to the Access forum.Anyway, questions:
1) what is the error that you are getting?
2) What does your code-behind look like when you "supply a date" (and it works)?
3) hmmm, try just taking the "&" out of the code-behind?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply