E
eighthman11
Hello Everyone.
Using Access 2000 and SQL Server 2008.
Below is an example of code I use to call a Stored Procedure on the
Sql Server. The Stored Procedure updates a worktable with records
based on the parameters that are passed. The worktable is used for an
Access report in my Access application. This works fine but is there
a way I can modify the call to my Stored Procedure to just return
records and use that data source for my report instead of using a
worktable on the sequel server. Any Help appreciated Thanks Ray.
Sub ReqAlertReport1(Co1 As Integer, UserName1 As String, ToLoc1 As
String, FromLoc1 As Integer, ReqNum1 As Long, Code1 As Integer)
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strConnectString As String
Dim Co As Integer
Dim UserName As String
Dim ToLoc As String
Dim FromLoc As Integer
Dim ReqNum As Long
Dim Code As Integer
Co = Co1
UserName = "'" & UserName1 & "'"
ToLoc = "'" & ToLoc1 & "'"
FromLoc = "'" & FromLoc1 & "'"
ReqNum = ReqNum1
Code = Code1
Set dbs = CurrentDb
strConnectString = "ODBC" & _
";Database=Viewpoint" & _
";UID=ODBC" & _
";PWD=odbc" & _
";DSN=Viewpoint"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnectString
qdf.ReturnsRecords = False 'Mark false if you do not want to return
records to application
qdf.SQL = "dbo.uspINToolOrderReqAlert " & Co & "," & Template & "," &
MatlGroup & "," & FromLoc & "," & Code & "," & CopyTemplate & ""
qdf.Execute ' use execute if ReturnsRecords = False
Set qdf = Nothing
End Sub
Using Access 2000 and SQL Server 2008.
Below is an example of code I use to call a Stored Procedure on the
Sql Server. The Stored Procedure updates a worktable with records
based on the parameters that are passed. The worktable is used for an
Access report in my Access application. This works fine but is there
a way I can modify the call to my Stored Procedure to just return
records and use that data source for my report instead of using a
worktable on the sequel server. Any Help appreciated Thanks Ray.
Sub ReqAlertReport1(Co1 As Integer, UserName1 As String, ToLoc1 As
String, FromLoc1 As Integer, ReqNum1 As Long, Code1 As Integer)
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strConnectString As String
Dim Co As Integer
Dim UserName As String
Dim ToLoc As String
Dim FromLoc As Integer
Dim ReqNum As Long
Dim Code As Integer
Co = Co1
UserName = "'" & UserName1 & "'"
ToLoc = "'" & ToLoc1 & "'"
FromLoc = "'" & FromLoc1 & "'"
ReqNum = ReqNum1
Code = Code1
Set dbs = CurrentDb
strConnectString = "ODBC" & _
";Database=Viewpoint" & _
";UID=ODBC" & _
";PWD=odbc" & _
";DSN=Viewpoint"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnectString
qdf.ReturnsRecords = False 'Mark false if you do not want to return
records to application
qdf.SQL = "dbo.uspINToolOrderReqAlert " & Co & "," & Template & "," &
MatlGroup & "," & FromLoc & "," & Code & "," & CopyTemplate & ""
qdf.Execute ' use execute if ReturnsRecords = False
Set qdf = Nothing
End Sub