• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

DAO 3.51 (Access97);how to SELECT from SQL Server with IN clause

how to specify a connection or connection parameters for the IN clause and select records from tables of SQL Server 2000 DB ? DSN for the SQL Server exists and has a known IP address.

Thanks a lot

Leif
0
LeifB
Asked:
LeifB
  • 3
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I do not really understand your problem, do you have an error or is it an understanding problem you have?
Can you post what you have working and what is not working...

CHeers
0
 
LeifBAuthor Commented:
I am not sure about the parameters for the IN clause to address a SQL Server 200. The Access 200 gives some examples for other DBs, here the dBase one:

SELECT CustomerID
FROM Customer
IN "" [dBASE IV; Database=C:\DBASE\DATA\SALES;]
WHERE CustomerID Like "A*";

Im pretty sure it should look something like[SQL Server 2000;  DSN = ...] if it works at all, but couldnt find anything.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
First, Check out this:
http://www.microsoft.com/accessdev/articles/odbcdir.htm

Hope this helps
0
 
LeifBAuthor Commented:
The article describes the standard method for DAO connecting, it is very good but does not explain the use of Selects with IN clause. The latter is not used much, mostly data is collected in recordsets. However we need to copy lots of tables directly from SQL Server to Access and the SELECT .. INTO .. FROM .. IN .. works wonderfully. AFter some playing around I found the solution, it works like this:

1. Create DSN for the SQL Server
2. Query in Access like this: Select * from sometable IN "" [ODBC;DSN=yourdsnhere;database=yourdatabasehere;]

however for some reason i get <deleted> markers all over, I will make a new question out of that on the SQL Server forum I think.
The points are for the time youve spent on my problem anyway, thanks for that ;)

Leif
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
As i couldn't test the ODBC;DSN= ... i didn't dare to post it :-(  but as you found the answer yourself !

I can answer right now on those rows #deleted#:
This happens typically when the base table doesn't have a primary key field...

CHeers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now