populate form with a recordset

J

Joseph Atie

Im trying to populate a form with a recordset using the following piece of code

Call open_recordset(rs, qry, check)
If check = 1 Then
DoCmd.OpenForm "equip_update_2", acNormal, , , acFormEdit,
acWindowNormal
DoCmd.Close acForm, "equip_update_1", acSaveNo
Forms!equip_update_2.Recordset = rs
Call close_recordset(rs)

im getting the error

runtime error 3251 operation is not supported for this type of object

ive done this many times before in sub & even subsub forms with no problem

anyone got any ideas as to what this error means?

also the form is bound to a table and the fields are bound to the fields of
that table.

i know i can manually push each field from the recordset to the field in the
form, but this way is alot neater.

help please
 
J

Joseph Atie

Hi roger

im using dao

the rs is declared as dao.recordset

the function open_recordset requires a dao recordset

the recordset existing long enough to replicate itself to the form and then
it closes

if it helps i will post the full functions, problem is i cant understand the
error

what object type am i using that is wrong?

ive used recordsets to populate forms in this manner many times before. its
a neat and easy way to populate a form without having hundreds of saved
queries that less apt users can accidently manipulate data with.

thanks in advance

Joseph Atie
 
R

Roger Carlson

As I said, it's only a guess. If you are explicitly defining your object
variables as DAO, that is:

Dim rs As DAO.Recordset

then that's probably not your problem.

But often, people will define recordset variables as:

Dim rs As Recordset

and if they have a reference to ADO above the DAO reference, they will get
that error when they try to use DAO methods against the ADO recordset.

Just to make sure, if you're not using ADO at all, you might want to remove
any reference to ADO from your References List. Likely it won't make a
difference, but you never know.

--
--Roger Carlson
MS Access MVP
www.rogersaccesslibrary.com
http://rogersaccessblog.blogspot.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top