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

Posted on 2002-05-24
Medium Priority
Last Modified: 2013-12-25
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

Question by:LeifB
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7031646
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...


Author Comment

ID: 7031834
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:

FROM Customer
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.
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 200 total points
ID: 7031899
First, Check out this:

Hope this helps

Author Comment

ID: 7031965
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 ;)

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7031998
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...


Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question