• PassThroughQuery Error #1013 (Access97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » PassThroughQuery Error #1013 (Access97)

    Author
    Topic
    #393673

    Below is my query and the error it is generating. Access97 is passing a query to SQL Server 7.

    SELECT dbo.tblMyTable.*
    FROM dbo.tblMyTable INNER JOIN dbo.tblMyTable ON tblFromAccess.PDATE = dbo.tblMyTable.PDATE;

    The error:

    [Micorsoft][ODBC SQL Server Driver][SQL Server]TABLES ; ‘dbo.tblMyTable’ and ‘ dbo.tblMyTable’ have the same exposed names. Use correlation names to distinguish them. (#1013)

    This is my first passthrough query and I really haven’t written many queries with SQL.

    Thanks

    Viewing 3 reply threads
    Author
    Replies
    • #715713

      I may be wrong but both tables have the same name, is that correct?
      If so you may need to give one or both an alias.

      • #715946

        Pat, could you give me an example of using alias?

        Thanks

        • #716297

          I was wrong, an alias wont solve your problem here. Take note of what Charlotte is saying.
          An example of an alias follows:
          SELECT T1.Code, T1.NameDesc FROM tblTablename as T1 …………….
          The T1 is the alias.

        • #716298

          I was wrong, an alias wont solve your problem here. Take note of what Charlotte is saying.
          An example of an alias follows:
          SELECT T1.Code, T1.NameDesc FROM tblTablename as T1 …………….
          The T1 is the alias.

      • #715947

        Pat, could you give me an example of using alias?

        Thanks

    • #715714

      I may be wrong but both tables have the same name, is that correct?
      If so you may need to give one or both an alias.

    • #715731

      You’re doing a self-join on dboMyTable but your ON clause contains tblFromAccess. Where the heck did that come from? Is tblFromAccess an Access table? If so, you aren’t going to be able to do a passthrough query.

      • #715944

        The query should read:

        SELECT dbo.tblMyTable.*
        FROM tblFromAccess INNER JOIN dbo.tblMyTable ON tblFromAccess.PDATE = dbo.tblMyTable.PDATE;

        I modeled the above query by joining two Access tables, running the query to make sure it worked and modifying and copying the SQL to the Passthrough query.

        The below query returns records:

        SELECT dbo.tblMyTable.*
        FROM dbo.tblMyTable
        WHERE dbo.tblMyTable.Product=’091503′;

        My attempt was to create a way the user could enter a date and return records from the SQL Server. Charlotte how is a criteria from Access passed to SQL Server?

        Thanks

        • #715952

          If you need to involve an Access table, then you have to use Jet SQL and run the query in Access. Otherwise, you may need to create a stored procedure in SQL Server and pass parameters into it.

        • #715953

          If you need to involve an Access table, then you have to use Jet SQL and run the query in Access. Otherwise, you may need to create a stored procedure in SQL Server and pass parameters into it.

      • #715945

        The query should read:

        SELECT dbo.tblMyTable.*
        FROM tblFromAccess INNER JOIN dbo.tblMyTable ON tblFromAccess.PDATE = dbo.tblMyTable.PDATE;

        I modeled the above query by joining two Access tables, running the query to make sure it worked and modifying and copying the SQL to the Passthrough query.

        The below query returns records:

        SELECT dbo.tblMyTable.*
        FROM dbo.tblMyTable
        WHERE dbo.tblMyTable.Product=’091503′;

        My attempt was to create a way the user could enter a date and return records from the SQL Server. Charlotte how is a criteria from Access passed to SQL Server?

        Thanks

    • #715732

      You’re doing a self-join on dboMyTable but your ON clause contains tblFromAccess. Where the heck did that come from? Is tblFromAccess an Access table? If so, you aren’t going to be able to do a passthrough query.

    Viewing 3 reply threads
    Reply To: PassThroughQuery Error #1013 (Access97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: