Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Running SQL 2008 queries from ACCESS 2007

Author  Topic 

ICE929RR
Starting Member

1 Post

Posted - 2011-04-11 : 07:52:54
Hi all,

I'm trying to run sql queries from Access 2007.

One of those queries has a function that I use on the query called "ApresStatusSol"

***********
Public Function ApresStatusSol(Id_Iniciativa As Long) As Integer

Set rs = CurrentDb.OpenRecordset("Select * From TblIniciativasSolucoes where id_iniciativa = " & Id_Iniciativa & "", dbOpenSnapshot)
If rs.RecordCount = 0 Then
ApresStatusSol = 0
Else
If rs.ID_Estado = 15 Then
ApresStatusSol = 1
Else
If rs.ID_Estado = 11 Then
ApresStatusSol = 2
Else
ApresStatusSol = 0
End If
ApresStatusSol = 0
End If
End If
rs.Close

End Function
*************

The question is... how do I run that procedure in SQL?

Like this.. ApresStatusSol([TblIniciativas].[id_iniciativa]) ?

Tks
   

- Advertisement -