SELCT DISTINCT Usr FROM Main_Table (Exception thrown.)

  • My code is below and terminates at the execution of the SQL query with this message:

    The Microsoft Access database engine can not find the input table or query 'SELCT DISTINCT Usr FROM Main_Table'. Make sure it exists and its name is spelled correctly.

    Public Sub WordCountByUser()

    If IsNull(DLookup("[Name]", "[MSysObjects]", "[Type] IN (1, 4, 6) AND [Name] = '" & "WordCountByUser" & "'")) Then

    CreateTable_WordCountByUser ("WordCountByUser")

    Else

    DoCmd.DeleteObject acTable, "WordCountByUser"

    CreateTable_WordCountByUser ("WordCountByUser")

    End If

    Dim dbs As DAO.Database

    Dim rstusr As DAO.Recordset2

    Set dbs = CurrentDb

    Set rstusr = dbs.OpenRecordset("SELCT DISTINCT Usr FROM Main_Table")

    Dim x As Integer

    x = 1

    End Sub

  • SELECT no SELCT. Lolll!!!!!!

  • Check you query syntax in your string "SELCT" >> "SELECT"

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Thanks. I have to be more careful of that stuff.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply