Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Unanswered: Visual Basic - ADO - Access - Problem

    hey,

    I'm having a serious problem here. I'm trying to update a table, but it keeps giving me an error: "data type mismatch in criteria expression".
    I saw that there were allready lots of problems on here, but none was able to help me.
    I'll give some more details.

    queryUpdate = _
    "UPDATE GeneralDocument " & _
    "SET [DeliveryDate] = '" & checkDate(txtDeliveryDate.Text) & "', " & _
    "[OrderID] = '" & orderValue & "', " & _
    "[OrderStatus] = '" & status & "', " & _
    "[OrderDate] = '" & checkDate(txtOrderDate.Text) & "', " & _
    "[OrderTypeID] = '" & orderTypeIdValue & "', " & _
    "[Price] = '" & txtPrice.Text & "', " & _
    "[OrderReason] = '" & txtOrderReason.Text & "', " & _
    "[TitelFree] = '" & txtTitelFree.Text & "', " & _
    "[FreeTextTop] = '" & txtFreeTextTop.Text & "', " & _
    "[ProductsFree] = '" & txtProductsFree.Text & "', " & _
    "[DeliveryTerms] = '" & txtDeliveryTerms.Text & "', " & _
    "[PaymentTerms] = '" & txtPaymentTerms.Text & "', " & _
    "[PackingTerms] = '" & txtPackingTerms.Text & "', " & _
    "[FreeTextBottom] = '" & txtFreeTextBottom.Text & "' " & _
    "WHERE [GeneralID] = '" & genValue & "'"

    The above is my update query.
    I can tell you the teh GeneralID is a text.
    and the checkDate makes the input as a string in "yyyy-mm-dd"- version.
    The genValue is a String.
    This GeneralID is also the Primary Key in my table.

    A weird thing is that if I update the table with the field OrderID, it works.
    So, I have really no idea anymore what it is.

    I hope it is something stupid that I looked over.
    But I hope someone can help me...

    Best Regards
    Wim

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Visual Basic - ADO - Access - Problem

    Try checking your VB query in Access, you usually get a better idea of the exact error like that. Here are the steps.

    1) Put a breakpoint in your vb code on the line after
    queryupdate = "UPDATE GeneralDocument..."

    2) In the immediate window type (with the question mark)
    ? queryupdate

    3) You will get the exact string that ms access will see when you send the query
    UPDATE GeneralDocument...

    4) Copy that string into a new access query and run it. Yoiu should be able to discover the error more easily now.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Apr 2004
    Posts
    2
    thx mate,

    I found it.
    I thought it had something to do with the Where-clause,
    so I was looking for that.

    I also had done some changes in the query,
    but, it seems that I just didn't do enough.
    But it works now.
    Thank you very much...
    You're a lifesaver...

    Best Regards,
    Wim

Posting Permissions

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