Results 1 to 3 of 3
  1. #1
    alangea is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    4

    SQL DELETE with ID fails (data type error)

    Hi
    Trying to delete a single record in my table I have programmed the following line:
    DoCmd.RunSQL "DELETE * FROM Person_data WHERE Id = '" & ids & "'"

    Id is the auto numbered key in the table
    ids is a Long



    I cant seem to find the right datatype for ids

    Thanks in advance for your help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    If ID is number type, remove the apostrophe delimiters, they are for text type, # is for date.

    DoCmd.RunSQL "DELETE * FROM Person_data WHERE Id = " & ids
    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
    alangea is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    4
    Thanks a lot.
    Stupid mistake to make...

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

Similar Threads

  1. Data type mismatch error
    By Tomfernandez1 in forum Programming
    Replies: 5
    Last Post: 10-05-2012, 07:27 AM
  2. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  3. Combo Box FK Data Type Error
    By southcraven in forum Database Design
    Replies: 7
    Last Post: 02-02-2012, 09:42 PM
  4. Data type mismatch error
    By AccessUser123 in forum Queries
    Replies: 1
    Last Post: 05-22-2011, 07:48 PM
  5. On delete cascade fails in constraint clause
    By Victor EGBE in forum Queries
    Replies: 0
    Last Post: 03-02-2009, 09:52 PM

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