I have noticed that intellisense stops at DAO.Recordset2, is this just a case of not needing to add it to the intellisensor because of how little it would be used, or does VBA limit you specifically to having only 2 open at a single time?
Asked
Active
Viewed 59 times
0
-
3What do you mean? Do you want a Recordset3, Recordset4? No such things. Recordset2 is a type of recordset object used to work with multi-value field. – June7 Mar 01 '23 at 18:48
-
That is exactly what I was getting at, even if I didn't know enough to ask it properly lol. I have never had to open more than two at a time before my current project, and when I did I had used Recordset2 for the second regardless of the field types I was working with. Thank you for correcting my assumptions! – Zrhoden Mar 01 '23 at 19:08
-
1More info https://stackoverflow.com/questions/15924557/differences-between-dao-recordset-dao-recordsets-dao-recordset2 – June7 Mar 01 '23 at 19:17
1 Answers
2
RecordSet2 is just a "addtional" "type" of variable, and has ZERO relatonship to the number of reocrdsets you want to open.
So, you are free to do this
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim rst3 As DAO.Recordset
'.etc. etc. etc.
Set rst1 = CurrentDb.OpenRecordset("tblHotels")
Set rst2 = CurrentDb.OpenRecordset("tblFood2")
'. etc. etc. etc...
the variable "type" DAO.RecordSet2 was introduced for support of so called multi-value fields (columns) in VBA, and in general is not required.

Albert D. Kallal
- 42,205
- 3
- 34
- 51