How to make an ADO recordset to be a data source for a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have form in my Access database and I want an ADO recordset to be a data
source for this form.
Can anybody help me, please?
Is it done through the RecordSource property? I've found something in the
VBA help, but it's a little bit unclear for me.
Thanks
 
Hi,
you can use Recordset Property of a form:
Returns or sets the ADO Recordset or DAO Recordset object representing the
record source for the specified form, report, list box control, or combo box
control. Read/write.

see online help for more info
 
Hi,
thank you for help.
In the online help are only table and SQL statement as RecordSource
examples, so this was a little bit unclear for me.
As I understand, the ADO recordset must be declared and opened in the VBA
module of the form I want to fill with the records from the recordset or must
be declared as a global variable.
Thank you again and wishing you prosperous year 2006.
Jaroslav
 
I think Alex may have a had shot or two too much of Vodka. The
recordSource for a form *MUST* be a SQL statement, saved query or table
name. If you want to use the recordSource of a form as the recordSource
for an ADO object that is possible, but not the other way around.

The question I would ask then is *WHY* are you wanting to take an ADO
recordset and use it as the dataSource for a form.

FYI - You can set the Form's recordset to the *VALUE* of the ADO
RecordSet's SQL Statement, but you cannot *EXECUTE* a query via ADO and
then put the results into a form.
 
Hi,
i don't have example around, but idea is easy - you just create a new ado
recordset, open it and then assign it to form's recordset property. i
remember i used this in ADP once, recordset was opened on a table from mdb
file, worked fine.

Happy New Year!
 
Maybe I've had one too many.

I thought that the original post was asking how to take the RECORDSET of
an ADO Object and use it as the RECORDSOURCE of a form. Am I correct
that that can't be done?
 
OK, so it can be done, but the question I would ask then is why would
you want to do it that way as opposed to useing a table, saved query or
SQL statement. Are there times when there is a need to open up a
one-time connection to another DB and return records from it?
 
Did you check the reference I posted? I believe it shows how to do it.

One reason you might want to do it is if you've got a disconnected
recordset.
 
for example - if you have ADP and need to update data in mdb - using
recordset property is the only way
 
O.K., guys, so I have to use the Recordset property.
The point is that I have no DB server, but I have to design an application
in MS Access which will allow multiple (approx. 5) users to use the same
data. So I decided to have one *.mdb file as a data source on the file server
and each user will have another *.mdb as in which will be only the user
interface and some temporary tables.
If there is some easier way to do that, please let me know.

Happy New Year to everybody

Jaroslav
 
Hi Jaroslav,
well, in this case (as i understand you) it is much more efficient to use
just linked tables, not need to use recordset property and load ADO
recordsets
 
Back
Top