Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set rs = without using db.OpenRecordset

Status
Not open for further replies.

GammelNok

Programmer
Jun 21, 2002
32
0
0
US
I am making my application ready for backending to SQL Server using ODBC.
How do I do 'Set rs = ..." without using db.OpenRecordset.
I need to loop through a table picking specific records.

Regards
Hans
 
set rs=db.openrecoredst("select....from tablename where.....",type)
 
why do you use ODBC to connect to sql-server???

microsoft did its best to create a better enviroment named ADO.

Its lots faster easier to work with and uses sql-server to the full. Christiaan Baes
Belgium
"What a wonderfull world" - Louis armstrong
 
Hi Chrissie1
Because we are not sure, we will be allowed to keep our SQL Server and are trying to make our code capable of returning to the Access environment if necessary, without a code rewrite.
Cheers
Hans
 
Using 'Set rs = Db.OpenRecordset' accesses the data depending on the CurrentProject.Connection whether tables are linked using ODBC or OLEDB.

So:
Dim rs As RecordSet
Set rs = Db.OpenRecordset("SELECT tblMine.* FROM tblMine;")
would create an ADO (default from Access 2000 on) recordset using the CurrentProject.Connection shown below. In this case it uses OLEDB. The connection is merely a function of the linking.

?CurrentProject.Connection
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\LogApps\ComponentsDb\COMPDB2K.MDB;Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database=C:\PROGRA~1\MICROS~2\ACCESS~1\Office\Office\SYSTEM.MDW;Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False

-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top