This is my code the theing that is giveing me a problem is how I pull in what is in fomula in the cell not the Value in the cell.

Function StandardSetup(Column1 As String, Column2 As String, Column3 As String, Column4 as Range)

Dim StandardRate        As Long

Set conn = CreateObject("ADODB.Connection")
Set recS = CreateObject("ADODB.Recordset")
    
    'Connect to the data base
    
    With conn
        .Provider = "sqloledb"
        .ConnectionString = "Data Source=CRV43;Initial Catalog=M2MDATA01;User ID=SA;Password=sysadmin;"
        .Open
    End With
    
    'Get data from Database
    
   strQuery = "Select " & Column1 & " From dbo.LABOR Where " & Column2 & "='" & Column3 & "'"
    
    recS.Open strQuery, conn
    
    If Range(Column4).HasFormula Then
    
     StandardRate = recS!Srate
    
    StandardSetup = SSetup * StandardRate / 60
    
    Else
    
    StandardRate = recS0
    
    End If
    
    recS.Close
    conn.Close
    Set recS = Nothing
    Set conn = Nothing
End Function