title: How to access SQL Server scalar functions in MS Access VB
body: <p>I'm trying to find out how I can access scalar functions from the SQL Server database of my adp file.</p>
  
  <p>I have an adp file in access 2007 and a SQL Server 2005 DB.</p>
  
  <p>In access VB I try to get the result of a scalar function with parameters.</p>
  
  <p>I tried with DAO, but it that case currentdb = nothing:</p>
  
  <pre><code>  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.Execute txt, dbFailOnError
  </code></pre>