开发者

How to access SQL Server scalar functions in MS Access VB

开发者 https://www.devze.com 2023-01-04 11:19 出处:网络
I\'m trying to find out how I can access scalar functions from the SQL Server database of my adp file.

I'm trying to find out how I can access scalar functions from the SQL Server database of my adp file.

I have an adp file in access 2007 and a SQL Server 2005 DB.

In access VB I try to get the result of a scalar function with parameters.

I tried with DAO, but it that case currentdb = nothing:

  Dim dbs As DAO.Database
  Dim sql2 As String
  Dim txt As String
  Dim iCount As Integer

  Set dbs = CurrentDb
  txt = "SELECT * FROM dbo.TBL_Klanten" '(tbl_klanten is in the msql DB) '
  dbs.Execut开发者_如何学JAVAe txt, dbFailOnError


DAO was never designed to access sql server even though its possible.

I believe the CurrentDB property is a DAO connection referencing the access database, and may not work with ADP, even though I don't really know since I've never used them.

ADO is the way you want to go with this.

I'm also assuming you're sticking with VBA rather than doing anything with .NET.

ADO API reference

ADO Objects reference

0

精彩评论

暂无评论...
验证码 换一张
取 消