Error Null Type Conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jclover
    New Member
    • Jul 2007
    • 17

    #1

    Error Null Type Conversion

    I'm using Microsoft Access to try to put together a form that enters data into a table when the form is closed, not a typical live form. Several fields are combo lists that pull from various queries. When I execute the code, I keep getting this error:

    1 field(s) set to Null due to type conversion.

    Here's the code:

    Code:
    Dim strSQL As String
    Dim Eff_Date As Long
    Eff_Date = Me.Eff_Date
    
    strSQL = "INSERT INTO tblMPR_Price([MPR_ID],[SKU],[Discount],[Eff_Date]," & _
    "[DeadOld],[DeadNew],[MAPOld],[MAPNew],[InvOld],[InvNew],[Rate]) " & _
    "VALUES ('" & Me.[MPR_ID] & "','" & Me.[SKU] & "','" & Me.[Discount] & "'," & Eff_Date & _
    ",'" & Me.[DeadOld] & "','" & Me.[DeadNew] & "','" & Me.[MAPOld] & _
    "','" & Me.[MAPNew] & "','" & Me.[InvOld] & "','" & Me.[InvNew] & _
    "','" & Me.[Rate] & "');"
    
    DoCmd.RunSQL strSQL
    Here's the field types.

    Dead*, MAP* and Inv* fields are currency
    Rate is Number
    Eff_Date is Date
    MPR_ID is Number
    SKU and DISCOUNT are Text

    I've noticed it seems to be linked to if the "DeadOLD" and "MapOLD" fields have a null value (since the value is populated by a query, if there's no match in the product type, no OLD pricing is pulled). Any ideas on how to handle this? The data gets tansferred still, it's just a nuissance.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    'Single Quotes Mean Text'
    #Hash Signs Mean Date#
    And no surrounding characters means it's a variable or a number.

    Comment

    Working...