Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bitten by Quotation Marks in Strings Bug? (A2k (9.0.3821) SR-1)

    Bitten by Quotation Marks in Strings Bug?

    A2k (9.0.3821) SR-1

    The following code works fine:
    strSQL = "Select * from " & mstrTableQueryName & _

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Bitten by Quotation Marks in Strings Bug? (A2k (9.0.3821) SR-1)

    Declare variable and use in the SQL expression:
    <pre> Dim strInterval as string
    strInterval = "m"
    "WHERE dtmDateCreate Between DateAdd(strInterval,-1,Date()) And Date()"</pre>

    And I think you were also missing a closing parentheses for the DateAdd function. It might be easier to read SQL expression if you use date variable:
    <pre> Dim dtFirstDate as Date
    dtFirstDate = DateAdd("m", -1, Date())
    "WHERE dtmDateCreate Between dtFirstDate And Date()"</pre>

    HTH

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Bitten by Quotation Marks in Strings Bug? (A2k (9.0.3821) SR-1)

    Generally use can use single-quotes within a string that delimited by double-quotes. So this should work:

    " WHERE dtmDateCreate Between DateAdd('m',-1,Date() And Date()"
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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