'How to create a user Login account in MS Access VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emmanuel Ayivi
    New Member
    • Mar 2011
    • 19

    'How to create a user Login account in MS Access VBA

    Please the SQL query is saying a error thus Expected end of statement can I know is wrong with it?

    strSQLDetails = "SELECT tFD.* " & _
    "FROM [tblFeesDetails] AS tFD" & _
    " INNER JOIN" & _
    " (SELECT LAST([Insect_Date and Time]) AS [LastDT]" & _
    " FROM [tblFeesDetails]" & _
    " WHERE ([GroupID] = '%G'")) AS sQ" & _
    " ON tFD.[Insect_Date and Time] = sQ.LastDT " & _
    "WHERE (tFD.GroupID = '%G'")
    strSQLDetails = Replace(strSQLD etails, "%G", mGroupID)
  • hype261
    New Member
    • Apr 2010
    • 207

    #2
    I can't see an obvious error in your syntax, but generally what I do in this situation is to copy the query and go to the query designer and put it on sql mode and paste it in. The query designer gives must better error messages on what is the problem than VBA.

    Comment

    • Emmanuel Ayivi
      New Member
      • Mar 2011
      • 19

      #3
      I copied the SQL query and pasted it in the designer and it says "Expected end of statement. so I tried going through but could not see anything wrong with it but the saying the is an error

      strSQLDetails = "SELECT tFD.* " & _
      "FROM [tblFeesDetails] AS tFD" & _
      " INNER JOIN" & _
      " (SELECT LAST([Insect_Date and Time]) AS [LastDT]" & _
      " FROM [tblFeesDetails]" & _
      " WHERE ([GroupID] = '%G'")) AS sQ" & _
      " ON tFD.[Insect_Date and Time] = sQ.LastDT " & _
      "WHERE (tFD.GroupID = '%G'")

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        The code you pasted into the SQL query editor is VBA code. That's not valid SQL.

        Also, are you sure it's supposed to be = "%G" and not Like "%G"?

        Comment

        Working...