Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax to insert variable (MSACCESS2003)

    I have a variable named Tname. I want to include this in the line strDeleteSQL = "DELETE FROM tname WHERE SD1DOC = '" & rst("SD1DOC") & "' " but have problems with the syntax. Many thanks

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

    Re: Syntax to insert variable (MSACCESS2003)

    Try
    <code>
    strDeleteSQL = "DELETE FROM [" & Tname & "] WHERE SD1DOC = '" & rst("SD1DOC") & "' "
    </code>
    The square brackets are needed if Tname contains spaces or punctuation; otherwise they won't do any harm.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax to insert variable (MSACCESS2003)

    Thanks very much Hans, that was quick!! Have a good weekend.

Posting Permissions

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