473,770 Members | 6,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set rs = db.OpenRecordse t(strSQL, dbOpenSnapshot) - Equivalent in ADO???

In my Access2000 .MDB database I use this sort of structure all over
the place (How do I replace it in my Access2000 .ADP database?):

Dim db as Database
Dim rs as DAO.Recordset
Dim strSQL as String
Dim myUniqueID as Long
Dim myExtract as Long

strSQL = "Select myTableName.myI DField, myTableName.myT extField " & _
"From myTableName " & _
"WHERE (((myTableName. MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordse t(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextFiel d")
' run some code here using myExtract
End if

I can't move foward with a major project until I can at least
understand this!
Any help is GREATLY appreciated.
lq
Nov 12 '05 #1
2 61353
SA
Lauren:

With an ADP, you use ADO as your data access technology. Here's some sample
code. If this is your first ADO/ADP project then run out and get the Access
Developer's Handbook volume 2 (which covers ADO, C/S and ADPs) is could be
invaluable.

Dim Conn As adodb.Connectio n
Dim rs As New adodb.Recordset
Dim strSQL As String

Set Conn = CurrentProject. Connection
Set rs = New adodb.Recordset

strSQL = "Select * from tblOrganization s"

rs.Open strSQL, Conn, adOpenKeyset, adLockOptimisti c
If rs.EOF = False Then
With rs
.MoveLast
Debug.Print .RecordCount
End With
End If
rs.Close

--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg
"Lauren Quantrell" <la************ *@hotmail.com> wrote in message
news:47******** *************** **@posting.goog le.com...
In my Access2000 .MDB database I use this sort of structure all over
the place (How do I replace it in my Access2000 .ADP database?):

Dim db as Database
Dim rs as DAO.Recordset
Dim strSQL as String
Dim myUniqueID as Long
Dim myExtract as Long

strSQL = "Select myTableName.myI DField, myTableName.myT extField " & _
"From myTableName " & _
"WHERE (((myTableName. MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordse t(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextFiel d")
' run some code here using myExtract
End if

I can't move foward with a major project until I can at least
understand this!
Any help is GREATLY appreciated.
lq

Nov 12 '05 #2
Steve,
Thanks for the code and the advice!
lq

"SA" <~f***********@ nspm.com> wrote in message news:<bn******* ***@ngspool-d02.news.aol.co m>...
Lauren:

With an ADP, you use ADO as your data access technology. Here's some sample
code. If this is your first ADO/ADP project then run out and get the Access
Developer's Handbook volume 2 (which covers ADO, C/S and ADPs) is could be
invaluable.

Dim Conn As adodb.Connectio n
Dim rs As New adodb.Recordset
Dim strSQL As String

Set Conn = CurrentProject. Connection
Set rs = New adodb.Recordset

strSQL = "Select * from tblOrganization s"

rs.Open strSQL, Conn, adOpenKeyset, adLockOptimisti c
If rs.EOF = False Then
With rs
.MoveLast
Debug.Print .RecordCount
End With
End If
rs.Close

--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg
"Lauren Quantrell" <la************ *@hotmail.com> wrote in message
news:47******** *************** **@posting.goog le.com...
In my Access2000 .MDB database I use this sort of structure all over
the place (How do I replace it in my Access2000 .ADP database?):

Dim db as Database
Dim rs as DAO.Recordset
Dim strSQL as String
Dim myUniqueID as Long
Dim myExtract as Long

strSQL = "Select myTableName.myI DField, myTableName.myT extField " & _
"From myTableName " & _
"WHERE (((myTableName. MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordse t(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextFiel d")
' run some code here using myExtract
End if

I can't move foward with a major project until I can at least
understand this!
Any help is GREATLY appreciated.
lq

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2283
by: K Williams | last post by:
I recently discovered that you can do the following: if currentdb.openrecordset ("select statement.....").eof = true then for cases when you just want to see if any records exist. This obviously does not assign the recordset to any variable. My question is, does this still use memory that is not freed because there is no "recset.close" and "set variable = nothing"?
2
4490
by: MLH | last post by:
I copied the following code right out of MS Access 2.0 HELP under Index Property Setting example... Sub Button0_Click () Dim MyDB As Database, MyTable As Recordset Set MyDB = DBEngine.Workspaces(0).Databases(0) Set MyTable = MyDB.OpenRecordset("tblOrders", DB_OPEN_TABLE) MyTable.Index = "PrimaryKey" MyTable.Seek "=", 10050 MyTable.Close
2
2345
by: JumpinJeff | last post by:
The code below is pretty straight forward. But I am having a problem adding with the Set rs1 statement. I keep getting a "Too Few Parameters - Expected 1" error. What I've added --and whatI suspect is causing problems-- is the parameter "intPONumber". I'm sure it's the formatting of the SQL string. Any help would be greatly appreciated. TIA! CODE
4
4463
by: google | last post by:
I am trying to implement form that allows a user to update data in multiple records in a table based on criteria they enter in the form. Because I want to allow some user interaction on a record level, and provide some additional data validation, I'm trying to do it with code instead of an update query. Unfortunately, it's not letting me update the data: I'm getting an error saying the data is read only. The same query statement, when...
0
1584
by: Greg Pyle | last post by:
I have created a parameter query (qryAuthors) that reads three parameters from three different fields on a subform (Subform1). Each time the form record changes, the query updates automatically. Now, I need to read the results of this query in an event procedure, but I consistently get a run-time error (3061): Too few parameters. Expected 3. The code I'm using to open the query's recordset is as follows: Set dbs=CurrentDb Set...
1
1645
by: MLH | last post by:
When the following runs, I get error saying "Jet can't find input table/query qdfMarkedAddnlOwnerRecs" The error occurs in line #150 Sub cmdSaveVehicleRec_Click() frmVehicleEntryForm. 120 Set MyDB = CurrentDb ' Set MyDB = OpenDatabase("Northwind.mdb") is alternate syntax. 140 With MyDB 149 Set qdfMarkedAddnlOwnerRecs = ..CreateQueryDef("NewQueryDef", "Select * From tblAddnlOwners Where =True;")
18
5096
by: Shawn Yates | last post by:
I have a report that looks up the earliest start time in a query . Right now it opens up the query and grabs the earliest start date like it should. This is the working code: Set rs = db.OpenRecordset("SELECT Min() AS MinOfStartTime " _ & " FROM Assignments", dbOpenSnapshot) The problem is that this query is showing start and finish times from different events. Is there a way to have it grab the earliest start
10
3742
by: MLH | last post by:
Gentlemen: I am having one heck of a time taking a DAO walk through the records in an SQL dynaset. I'm trying to walk a set of records returned by a UNION query. I'm attempting to filter the records to those related to vehicle #60 ( = 60 ). If I explicitly specify 60 in the SQL ==everything works fine. Take a look: 100 PString = "SELECT & " & Chr$(&H22) & Space(1) & Chr$(&H22) & " & AS Recipient " 120 PString = PString & "FROM...
7
11058
by: mirandacascade | last post by:
The questions are toward the bottom of this post. Situation is this: 1) Access 97 2) Multi-user appplication 3) SQL Server 2000 4) Sporadically (i.e. less than 1% of the time) encounter the following error: 3218 Couldn't update; currently locked
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.