Dynaset usage?

mlopes1

Registered User.
Local time
Today, 14:27
Joined
Sep 4, 2002
Messages
76
I have a text box on a form whose after update event is taking the value that was entered into the field and sending it to a query. If i perform this manually, meaning run the query in the after update it works just fine. But I want to learn how to do is set a Recordset equal to it. So what I have is this:

tblData = "qryTechTreeAll"
Set rst1 = dbs.OpenRecordset(tblData, dbOpenDynaset)
rst1.MoveFirst

I get an error that says "expected only 1 value" or something like that when it hits the Set rst1 line.
I also have this prior in my code and it works fine:

tblMaster = "tblTechMaster"
Set rst3 = dbs.OpenRecordset(tblMaster, dbOpenTable)
rst3.Index = "PrimaryKey"
rst3.MoveFirst

The query code which works when manually run is:

SELECT tblTechReqShort.TechResult AS Fld1
FROM tblTechReqShort
WHERE (((tblTechReqShort.TechResult)=[Forms]![frmTechTree]![CritTechID]))
ORDER BY tblTechReqShort

Am I using the OpenDynaset thing incorrectly or do you guys see something else here? I know you may wonder why the heck I am doing it this way at all... but without going into a ton of detail, let's just say I would MUCH prefer to use this recordset methodology than something else.

Any ideas? Thanks a ton as always!

Marco
 
My thinking is that

Set rst1 = dbs.OpenRecordset(tblData, dbOpenDynaset)

is a nonupdateable recordset precipitating the error message. "dbOpenDynaset" implies that your going to add, update or edit rst1 records.

You didn't post what you're attempting to do with rst1 records.

Try

Set rst1 = dbs.OpenRecordset(tblData, dbOpenSnapshot)

which is a mere non-updatable copy, that is, you can read the records.

But of course, I could be wrong.
 

Users who are viewing this thread

Back
Top Bottom