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

ADO connect on form

P: n/a
Dear Gurus,

I had never worked with ADO enviornment in access world.

can any one tell sample codes/ideas how to work with ado on form where
there r buttons like first, last, new, etc..i had done but giving me
probloem

++++++++++++++
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=X:\Register
System\Jeddah\takaful_claims.mdb;"

cn.Open strConn
rs.Open "select * from tblclaims;", strConn

rs.close

now i used like rs.movefirst, rs.movelast not working varous msgs
appearing on various buttons actions

regards
shahzad

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 17 Feb 2005 01:47:19 -0800, SalimShahzad <sa**********@gmail.com> wrote:
I had never worked with ADO enviornment in access world.

can any one tell sample codes/ideas how to work with ado on form where
there r buttons like first, last, new, etc..i had done but giving me
probloem

++++++++++++++
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=X:\Register
System\Jeddah\takaful_claims.mdb;"

cn.Open strConn
rs.Open "select * from tblclaims;", strConn

rs.close

now i used like rs.movefirst, rs.movelast not working varous msgs
appearing on various buttons actions


First, since you are referencing an mdb above, you should know that ADO
code cannot interact directly with an mdb form's recordset, just with the
underlying data.

Second, if you are using Access standalone, or on the front and back,
there is no need for the detailed connection string; use
CurrentProject.Connection as the Connection object:

Dim cnxn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnxn = CurrentProject.Connection
Set rs = New ADODB.Recordset
With rs
.Source = "select * from tblclaims"
.Open , cnxn, adOpenForwardOnly, adLockReadOnly, adCmdText
Do While Not .EOF

' Stuff

.MoveNext
Loop
.Close
End With
Set rs = Nothing
Darryl Kerkeslager
Nov 13 '05 #2

P: n/a
sir thanks for ur reply...

wants to know the complete form will be depentent on ADo so how we will
do that...

still things r nt clear can more clarify ...say there r text boxes,
combo boxes values will be appearing there..then action buttons
first,last, next,...action has not problem to write codes...

the way i was doing like vb was wrong...can u put some highlight thanks

regards,
shahzad

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.