Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

776 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