Ingeniero Sean, Lo felicito, la sencillez de su explicación es fabulosa, así como su generosidad al compartir sus conocimientos. Dios lo bendice. Un saludo desde Colombia
5:15 thanks for this! Question, why were you able to just use dim rsc As DAO.recordset without also having to create the Dim db as DAO.Database command? Can you leave that command out as given whenever you want to work in the current database?
Great question. In almost all contexts you can leave off "DAO." from the database object and it will default to DAO and you don't have to worry about it. You can add it to both Database and RecordSet to be more specific and it will work just fine. In some (rare by my experience) contexts, you DO need to add it to the Database object or it will not compile. Generally this is related either reference and/or MS Access version. RecordSet could point to either an ADODB recordset (most common in the VB6 world but often used in Access too) or a DAO recordset (most common in the Access world and rarely in the VB6 world). ADODB does not generally use the Database object in VBA since you use the Connection object instead to get your Recordset.
Great video. Tahnk you! Can this be used to make "pages" on a long continuous form? Like for example, if I have a form with a lot of records that I want to show only 50 records at a time, and then have "Next" and "Previous" buttons to go to the next or previous 50 records in the recordset? If so, how would you go about it?
I suppose you could have your subform loaded and when the user clicks next 50 as you suggest, just use the recordsetclone to scroll forward from the starting point of 0, get the bookmark, set the subform's recordset bookmark to the recordsetclone's. Have some marker fields that say "you are now viewing 51 to 100. The user looks at some records there, then clicks Next, the program gets 100 from the marker, scrolls forward 100 + 50 from a recordsetclone, sets the bookmarks again, etc. I think it is worth a try! You would have to account for when the user scrolls past the end of 50 (or to previous records) on their own and maybe auto-set the paging after detecting it. Something like that. Cool idea!
Nice video. But can you give a working example of when you should use a form's RecordsetClone property rather than the Clone method of the form's Recordset and vice versa?
One example is that a RecordsetClone is always read-only, whereas the Clone method can be used to create one or more RecordSets that might not be read-only. You don't want to trigger a lock conflict by navigating and updating the same data via several Clones (plus the open form!).
Interesting.. I would make sure that you make sure to reference DAO.Recordset in your dim statement and not just Recordset. Also, try a Debug > Compile as sometimes it might be fine but Intellisense did not recognize it (but it will run). If you don't get an error on Compile, it might be fine.
Ingeniero Sean, Lo felicito, la sencillez de su explicación es fabulosa, así como su generosidad al compartir sus conocimientos. Dios lo bendice. Un saludo desde Colombia
Muchas gracias, me alegra que te guste el programa 🛠
Great job, thanks so much.
Glad it was helpful!
5:15 thanks for this! Question, why were you able to just use dim rsc As DAO.recordset without also having to create the Dim db as DAO.Database command? Can you leave that command out as given whenever you want to work in the current database?
Great question. In almost all contexts you can leave off "DAO." from the database object and it will default to DAO and you don't have to worry about it. You can add it to both Database and RecordSet to be more specific and it will work just fine. In some (rare by my experience) contexts, you DO need to add it to the Database object or it will not compile. Generally this is related either reference and/or MS Access version. RecordSet could point to either an ADODB recordset (most common in the VB6 world but often used in Access too) or a DAO recordset (most common in the Access world and rarely in the VB6 world). ADODB does not generally use the Database object in VBA since you use the Connection object instead to get your Recordset.
Great video. Tahnk you! Can this be used to make "pages" on a long continuous form? Like for example, if I have a form with a lot of records that I want to show only 50 records at a time, and then have "Next" and "Previous" buttons to go to the next or previous 50 records in the recordset? If so, how would you go about it?
I suppose you could have your subform loaded and when the user clicks next 50 as you suggest, just use the recordsetclone to scroll forward from the starting point of 0, get the bookmark, set the subform's recordset bookmark to the recordsetclone's. Have some marker fields that say "you are now viewing 51 to 100. The user looks at some records there, then clicks Next, the program gets 100 from the marker, scrolls forward 100 + 50 from a recordsetclone, sets the bookmarks again, etc. I think it is worth a try! You would have to account for when the user scrolls past the end of 50 (or to previous records) on their own and maybe auto-set the paging after detecting it. Something like that. Cool idea!
@@seanmackenziedataengineering Thank you for your reply! A video on this would be awesome 😉
Nice video. But can you give a working example of when you should use a form's RecordsetClone property rather than the Clone method of the form's Recordset and vice versa?
One example is that a RecordsetClone is always read-only, whereas the Clone method can be used to create one or more RecordSets that might not be read-only. You don't want to trigger a lock conflict by navigating and updating the same data via several Clones (plus the open form!).
I've tried using database clone...but it doesn't recognize the command. Any thoughts? I've checked all my libraries and I beileve they all load fine?
Interesting.. I would make sure that you make sure to reference DAO.Recordset in your dim statement and not just Recordset. Also, try a Debug > Compile as sometimes it might be fine but Intellisense did not recognize it (but it will run). If you don't get an error on Compile, it might be fine.