Results 1 to 3 of 3

Thread: RUNSQL (2003)

  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    RUNSQL (2003)

    Any ideas why this code will not work? When pasted into a QBD window it works fine. (The lines that define the strSql are one line in the code window)
    Thanks


    Dim strSql As String
    strSql = "SELECT tblKever.intTikCurrent, tblKever.txtFirstName, tblKever.txtLastName, tblKever.txtGender, tblKever.intCemetary, tblKever.dtBirth, tblKever.dtNiftar, tblKever.dtBurial, tblKever.intCodeBTL, tblKever.intTikBefore, tblKever.ynBuried From tblKever WHERE (((tblKever.dtBurial) Between [Forms]![frmHitpalgutChoices]![dtFrom] And [Forms]![frmHitpalgutChoices]![dtTill]) AND ((tblKever.ynBuried)=-1));"
    DoCmd.RunSQL (strSql)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: RUNSQL (2003)

    The SQL is for a select query that returns records.
    DoCmd.RunSQL is intended to execute the SQL for action queries that manipulate records in some way: a make-table query, append query, update query or delete query. Since a select query doesn't modify records, DoCmd.RunSQL doesn't work.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RUNSQL (2003)

    thanks forgot that I have been out of Access for a while

Posting Permissions

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