Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2005

Tip: Looking for answers? Try searching our database.

ADO connect on  form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SalimShahzad - 17 Feb 2005 09:47 GMT
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
Darryl Kerkeslager - 17 Feb 2005 13:25 GMT
> I had never worked with ADO enviornment in access world.
>
[quoted text clipped - 16 lines]
> 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
SalimShahzad - 19 Feb 2005 07:05 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.