I have a stored procedure that returns no results:
CREATE PROCEDURE dbo.sp_att (@ID Core_AdmissionsNumber)
AS
CREATE TABLE dbo.StudentAtt(StudID Core_AdmissionsNumber)
INSERT INTO dbo.StudentAtt (StudID)
SELECT AdmissionsNumber
FROM dbo.tbl_student_name
WHERE dbo.tbl_student_name.AdmissionsNumber=@ID
ORDER BY dbo.tbl_student_name.AdmissionsNumber
GO
and this is executed from an Access form with the following code:
Private Sub btnStudentAttWkMth_Click()
Dim db As Connection
Dim spsend As String
Dim StudentID As String
Set db = New Connection
StudentID = "Forms!frm_StudentInfo!cmbStudent"
'Open db connection
db.Open ("provider = sqloledb; data source = XXXXX; initial catalog = XXX; user id = XXXXXX;password = XXXXXXX")
'Run Stored Procedure to create Table and filter to correct students
spsend = "Execute sp_att @ID='" & StudentID & "'"
db.Execute spsend
Dim stDocName As String
stDocName = "rpt_Student_Attendance(Wk/Mth)"
DoCmd.OpenReport stDocName, acPreview
End Sub
The cmbStudent is populated and should be passed through to populate the table created with a single cell of data.
Additionally, what would be the best method when re-executing the table with new data? Truncating/Deleting???
Thanks
Simon
CREATE PROCEDURE dbo.sp_att (@ID Core_AdmissionsNumber)
AS
CREATE TABLE dbo.StudentAtt(StudID Core_AdmissionsNumber)
INSERT INTO dbo.StudentAtt (StudID)
SELECT AdmissionsNumber
FROM dbo.tbl_student_name
WHERE dbo.tbl_student_name.AdmissionsNumber=@ID
ORDER BY dbo.tbl_student_name.AdmissionsNumber
GO
and this is executed from an Access form with the following code:
Private Sub btnStudentAttWkMth_Click()
Dim db As Connection
Dim spsend As String
Dim StudentID As String
Set db = New Connection
StudentID = "Forms!frm_StudentInfo!cmbStudent"
'Open db connection
db.Open ("provider = sqloledb; data source = XXXXX; initial catalog = XXX; user id = XXXXXX;password = XXXXXXX")
'Run Stored Procedure to create Table and filter to correct students
spsend = "Execute sp_att @ID='" & StudentID & "'"
db.Execute spsend
Dim stDocName As String
stDocName = "rpt_Student_Attendance(Wk/Mth)"
DoCmd.OpenReport stDocName, acPreview
End Sub
The cmbStudent is populated and should be passed through to populate the table created with a single cell of data.
Additionally, what would be the best method when re-executing the table with new data? Truncating/Deleting???
Thanks
Simon