473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Set rs = db.OpenRecordset(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.myIDField, myTableName.myTextField " & _
"From myTableName " & _
"WHERE (((myTableName.MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextField")
' 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 61307
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.Connection
Dim rs As New adodb.Recordset
Dim strSQL As String

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

strSQL = "Select * from tblOrganizations"

rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
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.google.co m...
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.myIDField, myTableName.myTextField " & _
"From myTableName " & _
"WHERE (((myTableName.MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextField")
' 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.com>...
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.Connection
Dim rs As New adodb.Recordset
Dim strSQL As String

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

strSQL = "Select * from tblOrganizations"

rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
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.google.co m...
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.myIDField, myTableName.myTextField " & _
"From myTableName " & _
"WHERE (((myTableName.MyIDField) = " & myUniqueID & ")))"

Set db = CurrentDB()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextField")
' 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
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...
2
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 =...
2
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...
4
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...
0
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. ...
1
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 ...
18
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 =...
10
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...
7
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.