Recent content by popaddar

  1. P

    Using a VBA function in SQL Query

    I understand that the issue is in the Test1 = MovingDiff Statement. Why does this not work?
  2. P

    Using a VBA function in SQL Query

    Yes Test1 = MovingDiff is commented out since I get a error-message there. But I'm not sure whether you neccessarily nead it since the function seems to work in the immediate window. I will have a closer look to this since this might be the issue. @ Minty: Thank you but this isn't the issue!
  3. P

    Using a VBA function in SQL Query

    Yes the code I posted is working so far. If I run ?Test1("PRICE2",1) in the immediate window i get the correct result (PRICE2 is a table in my Database). However, I want to use a SQL query to call the function and do the calculation: SELECT PRICE2.ID, Test1("PRICE2",1) AS MDiff FROM PRICE2...
  4. P

    Using a VBA function in SQL Query

    The function should calculate moving changes with a lag of 3 days. For example, assumed i have the following time-series: Table: PRICE2 Date Stock1 19.02.2015 2 20.02.2015 5 23.02.2015 4 24.02.2015 5 25.02.2015 7 26.02.2015 9 The function returns: 24.02.2015 1.5 (5/2-1) 25.02.2015 0.4 (7/5-1)...
  5. P

    Using a VBA function in SQL Query

    Hi Thank you for your tip. However, I declared the function and also checked that the function is in a module and it still doesn't work. Here my code again if it helpful: Public Function Test1(Tbl As String, Clmn As Integer) As Double Dim MyDb As dao.Database Dim Tbldef As dao.TableDef...
  6. P

    Using a VBA function in SQL Query

    Hi I'm trying to use a VBA function that I specified myself in a SQL query. My function is: Public Function Test1(Tbl As String, Clmn As Integer) Dim MyDb As dao.Database Dim Tbldef As dao.TableDef 'Dim Tbl As String Dim ColName As String 'Dim Clmn As Integer Dim Que1 As dao.Recordset...
Back
Top Bottom