Results 1 to 5 of 5
  1. #1
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    118

    strSQL Delete

    Can somebody tell me what I am doing wrong? I am trying to run delete statement where Pending_Notes = "". (Is null) doesn't work.
    Thanks

    Private Sub btnHistory_Click()
    Dim strSQL As String
    strSQL = "DELETE * FROM [tblHistory]" & _


    "WHERE [Pending_Notes] ='""'"
    CurrentDb.Execute strSQL

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Space before where


    Sent from my iPhone using Tapatalk

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    build a query from this sql.
    it will give you error messages.

    But usu its
    WHERE [Pending_Notes] is null

  4. #4
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    118
    I have added space as you suggested but still get syntax error 3075.
    I also run simple qry with 'is null' as ranman256 suggested but no record was selected, only "" works.
    DELETE tblHistory.[Pending_Notes], *
    FROM tblHistory
    WHERE (((tblHistory.[Pending_Notes])=""));

    My problem is I don't know how to change delete query to code and not get an error?

  5. #5
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Code:
    DELETE * FROM [tblHistory]" & _
     " WHERE [Pending_Notes] is null));"

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

Similar Threads

  1. Help~ Ado Vba - trying to call strsql(INSERT)
    By fluffyvampirekitten in forum Access
    Replies: 4
    Last Post: 11-02-2015, 07:58 PM
  2. How to add counter to StrSQL vba?
    By Jo.. in forum Queries
    Replies: 2
    Last Post: 09-09-2015, 08:09 AM
  3. VBA strSQL mismatch
    By SPW_12 in forum Programming
    Replies: 12
    Last Post: 07-31-2012, 07:47 PM
  4. Need to add 2nd criteria to strSQL
    By robsworld78 in forum Forms
    Replies: 8
    Last Post: 08-23-2011, 02:57 PM
  5. DLookup in strSQL for OpenRecordset
    By szucker1 in forum Programming
    Replies: 2
    Last Post: 07-30-2011, 06:00 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