Solved

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

Posted on 2002-05-24
5
238 Views
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

Leif
0
Comment
Question by:LeifB
  • 3
  • 2
5 Comments
 
LVL 142

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

CHeers
0
 
LVL 1

Author Comment

by:LeifB
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:

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
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 7031899
First, Check out this:
http://www.microsoft.com/accessdev/articles/odbcdir.htm

Hope this helps
0
 
LVL 1

Author Comment

by:LeifB
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 ;)

Leif
0
 
LVL 142

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

CHeers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Opening Remote & Local Data Connection 2 51
Access 2003, my txt file export is running backwards 4 46
VBA filters 2 51
How does CurrentUser work? 10 31
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now