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

Posted on 2002-05-24
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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SLMGR Switches Are Not Working On KMS Host 3 169
Excel Automation VBA 19 115
Error with a code discussed on this page 5 48
SQL Server 2012 to SQL Server 2016 24 54
Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

737 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