Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012

    Unanswered: Run-Time error '94' Invalid use of Null


    I was using Access 2010, now i Upsized it to MS SQL 2012.

    I'm getting Run-Time error '94'


    Public Function CalcOrderSubTotal(prmOrderID As Integer, _
    Optional CallFromMacro As Boolean = True)

    Dim varOrderSubTotal As Integer

    Dim db As DAO.Database
    Dim rs As Recordset
    Dim strSQL As String

    varOrderSubTotal = 0

    Set db = CurrentDb
    strSQL = "SELECT OrderID, ExtendedPrice FROM OrderDetails WHERE OrderID = " & prmOrderID

    Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

    Do While Not rs.EOF
    varOrderSubTotal = varOrderSubTotal + rs!ExtendedPrice

    If CallFromMacro Then
    [TempVars]![retOrderSubTotal] = varOrderSubTotal
    CalcOrderSubTotal = varOrderSubTotal
    End If

    End Function


    Can you please help me to find out what is the problem.
    I was searching online for two day now and could not find anything.

    Thank you

  2. #2
    Join Date
    Aug 2008
    Could you confirm what value is contained in those two variables? One of them must be NULL.
    Have you checked the records from the database?

  3. #3
    Join Date
    Oct 2012
    Thank you JackVamvas for reply.
    I think i found the problem, which is prmOrderID, parameter.
    I was using access table data macros, which has to
    convert into SQL Server triggers.

    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts