Results 1 to 4 of 4
  1. #1
    Vanita is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Posts
    23

    Run-time error '3464' Datatype mismatch in criteria expression: PLEASE HELP!!

    Hi,
    For below code I'm getting Run-time error '3464' Datatype mismatch in criteria expression Error.

    Please help me to solve this code.

    Private Sub Save_Click()
    If IsNull(Customer) Or IsNull(Cust_PO_No) Or IsNull(Cust_PO_Date) Or IsNull(Ship_To) Or IsNull(PO_line_item) Or IsNull(Item_No) Or IsNull(Dwg_rev_No) Or IsNull(PO_Qty_Blanket) Or IsNull(PO_Qty_Release) Or IsNull(Unit_Price) Or IsNull(ModeOf_Shipment) Or IsNull(Delivery_Terms) Or IsNull(Cust_Requested_Date) Or IsNull(Succinnova_Committed_date) Then
    MsgBox "Please Fill Empty Fields ", , "Details required"
    Else


    If MsgBox("Do you want to submit the details of Order_Processing Form?", vbYesNo + vbQuestion) = vbYes Then
    CurrentDb.Execute "INSERT INTO Order_Processing_Table([OCNumber],[Customer],[Cust_PO_No],[Cust_PO_Date],[Ship_To],[PO_line_item],[Item_No],[Dwg_rev_No],[PO_Qty_Blanket],[PO_Qty_Release],[Unit_Price],[Type_of_Currency],[ModeOf_Shipment],[Delivery_Terms],[Cust_Requested_Date],[Succinnova_Committed_date],[Remarks])" & _
    "VALUES('" & Me.OCNumber & "','" & Me.Customer & "','" & Me.Cust_PO_No & "','" & Me.Cust_PO_Date & "','" & Me.Ship_To & "','" & _
    Me.PO_line_item & "','" & Me.Item_No & "','" & Me.Dwg_rev_No & "','" & Me.PO_Qty_Blanket & "','" & Me.PO_Qty_Release & "','" & Me.Unit_Price & "','" & Me.Type_of_Currency & "','" & Me.ModeOf_Shipment & "','" & Me.Delivery_Terms & "','" & Me.Cust_Requested_Date & "','" & Me.Succinnova_Committed_date & "','" & Me.Remarks & "')"
    MsgBox "Details Submited to Order_Processing_Table"
    Me.OCNumber.Value = Null
    Me.Customer.Value = Null
    Me.Cust_PO_No.Value = Null
    Me.Cust_PO_Date.Value = Null
    Me.Ship_To.Value = Null
    Me.PO_line_item.Value = Null
    Me.Item_No.Value = Null
    Me.Dwg_rev_No.Value = Null
    Me.PO_Qty_Blanket.Value = Null


    Me.PO_Qty_Release.Value = Null
    Me.Unit_Price.Value = Null
    Me.ModeOf_Shipment.Value = Null
    Me.Delivery_Terms.Value = Null
    Me.Cust_Requested_Date.Value = Null
    Me.Succinnova_Committed_date.Value = Null
    Me.Remarks.Value = Null
    Else
    Me.OCNumber.Value = Null
    Me.Customer.Value = Null
    Me.Cust_PO_No.Value = Null
    Me.Cust_PO_Date.Value = Null
    Me.Ship_To.Value = Null
    Me.PO_line_item.Value = Null
    Me.Item_No.Value = Null
    Me.Dwg_rev_No.Value = Null
    Me.PO_Qty_Blanket.Value = Null
    Me.PO_Qty_Release.Value = Null
    Me.Unit_Price.Value = Null
    Me.ModeOf_Shipment.Value = Null
    Me.Delivery_Terms.Value = Null
    Me.Cust_Requested_Date.Value = Null
    Me.Succinnova_Committed_date.Value = Null
    Me.Remarks.Value = Null
    MsgBox "Details Not Submited"
    Exit Sub
    End If
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Date/time fields require # delimiter, not apostrophe.

    & "',#" & Me.Cust_PO_Date & "#,'" &

    & "',#" & Me.Cust_Requested_Date & "#,'" &

    & "',#" & Me.Succinnova_Committed_date & "#,'" &

    Number type fields do need any delimiter.

    Only text type fields use apostrophe delimiter.

    Why do you need to use INSERT action to save record? Why don't you use bound form?

    For future, please post lengthy code between CODE tags to retain indentation and readability.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,413
    a number of missing spaces as well

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This will help debug and implement those suggestions:

    http://www.baldyweb.com/ImmediateWindow.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 07-25-2019, 05:49 PM
  2. Replies: 8
    Last Post: 03-14-2017, 02:36 PM
  3. Replies: 2
    Last Post: 08-24-2015, 09:14 PM
  4. Replies: 2
    Last Post: 07-08-2015, 04:07 PM
  5. datatype mismatch in criteria expression
    By CyberSkillsz in forum Access
    Replies: 1
    Last Post: 06-14-2011, 10:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums