run-time error 3705

P

phillip9

Hello,

I am using access 2002 and receive this error on a form, where I have a
combo-box that display's all the properties in my database for the user to
select.

run-time error 3705: operation is not allowed when the object is open.

When the user makes a selection from the combo box some vba code runs to
pull up more information about the property.

I was able to use this with older DAO with no problem, but I'm trying to
convert DAO code to ADO and have run into this problem.

the code and sql are listed below:


thank you,

phill



vba code:
Dim sqlString As String
Dim cnn As adodb.Connection
Dim rst As adodb.Recordset
'Set cnn = New adodb.Connection
Set cnn = CurrentProject.Connection
Set rst = New adodb.Recordset
sqlString = "SELECT
property_id,servicing_site_name_text,project_manager_name_text,property_name_text FROM active_property WHERE property_id = " & PID
rst.Open (sqlString), cnn ' ******** error happens on this line ******




sql query in the form:
form combo-box (table/query: this is qryPropertyID)

SELECT DISTINCTROW active_property.property_id,
active_property.property_name_text, active_property.associated_fha_number
FROM active_property
ORDER BY active_property.property_name_text;
 

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