Petr Danes
Registered User.
- Local time
- Today, 06:24
- Joined
- Aug 4, 2010
- Messages
- 150
I can do that, but I also need to set the current record of the form. Most of this is taking place in a search function. The user specifies a record indentifier, and the DB searches for a record matching that request. When such a record(s) exists, the subform is supposed to display it. Sometimes the record is in the recordset already displayed, sometimes it is in the DB but not in the current display set, in which case the pass-through query is changed to include that record, sometimes as a singleton, sometimes as part of a larger set, depending on many things. But in all cases, the subform winds up with a recordset containing at least the record(s) that match the search criteria. After finding the record, I want to position the subform's current record pointer to that found record, or the first match if there are several. THAT is where I need to use the .Recordset property of the subform, and THAT is what is crashing. Things like getting the .RecordCount property I can do with the clone, although I don't see why using a clone should have any advantage over the original - seems to me that all it does is add confusion. But positioning the clone does not update the display, which is what I need to do.Then maybe you need to use the old-fashioned way of opening a recordset:
I have never used the Form.RecordSet methodology you are trying. I doubt it will work very well or work consistently though especially if you are referencing subforms.Code:Dim dbs As DAO.Database Dim rsTable As DAO.Recordset Set dbs = CurrentDb Set rsTable = dbs.OpenRecordset("YOUR TABLE NAME OR SQL") With rsTable .MoveLast .MoveFirst MsgBox .RecordCount .Close End With
Last edited: