sql correct sintax for delete a  record from the date

Posted on 2005-04-18
Last Modified: 2010-05-02
Hi you guys what is the correct syntax for delete a record from sql statement like this

 sqlstring = " delete from masacor where folio= " & regact & " and dia='18/04/2005'"  

the error is
Data type mismatch
Question by:edo60
    LVL 69

    Accepted Solution

    if folio is of character type, it has to be surrounded by single quotes

    sqlstring = " delete from masacor where folio= '" & regact & "' and dia='18/04/2005'"  

    If your database is Access, the date needs to be surrounded with #

    sqlstring = " delete from masacor where folio= " & regact & " and dia=#18/04/2005#"  

    Author Comment

    Thats it

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now