Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PassThroughQuery Error #1013 (Access97)

    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

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: PassThroughQuery Error #1013 (Access97)

    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.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PassThroughQuery Error #1013 (Access97)

    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.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PassThroughQuery Error #1013 (Access97)

    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

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PassThroughQuery Error #1013 (Access97)

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

    Thanks

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PassThroughQuery Error #1013 (Access97)

    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.
    Charlotte

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: PassThroughQuery Error #1013 (Access97)

    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.

Posting Permissions

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