Filtering a recordset loses caption in the yeild

H

Hamid

Hi all,
I hope it is not off topic.

It turns out that filtering a recordset, creates recordsets that do not
inherit the parent recordsets caption. Is this true? Besides I can not
add any property to fields of the recordset. Are they readonly?

I am using
MS Access 2003 (11,6355,6360) SP1
MS Windows XP Home Edition Version 2002 Service Pack 1

' Snippet----------

' Recordsets are all declared DAO.Recordset

With rstCourseAll
.Filter = "isMain = '*'"
Set rstCourseMain = .OpenRecordset
.Filter = "isMain <> '*'"
Set rstCourseExtra = .OpenRecordset
End With

' Snippet End------

Thanx for your attention.
 
A

Allen Browne

Hamid, AFAIK, recordsets do not have a Caption property.

Forms do. Labels do. Command buttons do.
Fields of a TableDef sometimes do.
You can add properties to the Field of a TableDef.
I never tried adding properties to a Field of a Recordset: it dooesn't sound
useful, as it would only survive for the lifetime of the recordset.

If you are trying to assign a different name for the fields in a recordset,
OpenRecordset on an SQL statement that aliases the fields, e.g.:
strSql = "SELECT Field1 AS MyNewName FROM Table1;"
Set rstCourseAll = db.OpenRecordset(strSql)
 
H

Hamid

Hi Allen,

Thanx for the comments. I thought deriving a recordset from an existing
one would be more efficeint. In my UI design I put a listbox with a
dynamic value list rowsource that user is able to filter / unfilter its
rows with a click on an option group. I needed to use value list rather
than table/query. Anyway I guess with that little data in my program,
it will not hurt and I see workarounds.

Warm thanks from a far way.

Hamid.
 
Top