[AccessD] Setting a forms recordsource using ADO

Charlotte Foust cfoust at infostatsystems.com
Fri Mar 7 10:27:00 CST 2003


Keep in mind though that forms bound to ADO recordsets are not
updateable in an MDB.

Charlotte Foust

-----Original Message-----
From: MartyConnelly [mailto:martyconnelly at shaw.ca] 
Sent: Thursday, March 06, 2003 9:19 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Setting a forms recordsource using ADO


Here is a sample unbound form have a look around this site for other
samples
http://www.rogersaccesslibrary.com/download.asp?SampleName='UnboundSQL.m
db'
In code just change the DAO openrecordset  to your ado recordset

Set rsCust = D.OpenRecordset(strSQL, DB_OPEN_DYNASET)

Me!ACCOUNT = rsCust("ACCOUNT")

jeffrey.demulling at usbank.com wrote:

>
> I have the current code for an on click event:
>
> Dim cn As New ADODB.Connection
> Dim rs As New ADODB.Recordset
> Dim strConnectionString As String
> Dim cmdText As String
> Dim fld As ADODB.Field
>
>
> cn.Provider = "SQLOLEDB"
> cn.Properties("Data Source") = <my server here> cn.Properties("Initial

> Catalog") = <my database here> cn.Properties("User ID") = <my user id 
> is here>
> cn.Properties("Password") = <my password is here>
> cn.Open
>
>
> cmdText = "Select * From tblregions"
>
> rs.Open cmdText, cn
>
> Me.RecordSource = rs.GetRows
>
> rs.MoveFirst
>
> Do Until rs.EOF
>     MsgBox rs.Fields("Number")
>     rs.MoveNext
> Loop
>
> This code allows me to Loop through the recordset and see the values
> in a message box.
>
> Now what I want to do is place the information on a form (continous
> would be fine for now).
>
> If any one can help me with this ADO stuff I would appericate it very
> much, as I am just now getting to play with it.
>
> Thanks!!!
>
> rs.Close
> End Sub



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list