By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,940 Members | 611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,940 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.