Microsoft KB Archive/103402: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 19: | Line 19: | ||
When you first create a snapshot recordset, memory is allocated to store data. In order to optimize memory, Microsoft Access does not load all the table's records at once, meaning that you have only a partial recordset in memory. When you move to the end of the snapshot, the link is then cut from the live table. | When you first create a snapshot recordset, memory is allocated to store data. In order to optimize memory, Microsoft Access does not load all the table's records at once, meaning that you have only a partial recordset in memory. When you move to the end of the snapshot, the link is then cut from the live table. | ||
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the | This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications" manual. | ||
NOTE: Visual Basic for Applications (used in Microsoft Access for Windows 95, version 7.0) is called Access Basic in version 2.0. | NOTE: Visual Basic for Applications (used in Microsoft Access for Windows 95, version 7.0) is called Access Basic in version 2.0. | ||
Line 38: | Line 38: | ||
<li><p>Create a new module and add the following function:</p> | <li><p>Create a new module and add the following function:</p> | ||
<blockquote><pre> Public Function Udate()</pre></blockquote> | <blockquote><pre> Public Function Udate()</pre></blockquote> | ||
<p>NOTE: In Microsoft Access version 2.0 do not use the word | <p>NOTE: In Microsoft Access version 2.0 do not use the word "Public" in front of the function name.</p> | ||
<blockquote><pre> Dim MyDB As Database | <blockquote><pre> Dim MyDB As Database | ||
Dim MyTable As Recordset | Dim MyTable As Recordset | ||
Dim MySnap As Recordset</pre></blockquote> | Dim MySnap As Recordset</pre></blockquote> | ||
<blockquote><pre> Set MyDB = CurrentDb() | <blockquote><pre> Set MyDB = CurrentDb() | ||
Set MyTable = MyDB.OpenRecordset( | Set MyTable = MyDB.OpenRecordset("Cat", dbOpenTable) | ||
Set MySnap = MyTable.OpenRecordset(dbOpenSnapshot)</pre></blockquote> | Set MySnap = MyTable.OpenRecordset(dbOpenSnapshot)</pre></blockquote> | ||
<blockquote><pre> MyTable.AddNew | <blockquote><pre> MyTable.AddNew | ||
MyTable![CategoryName] = | MyTable![CategoryName] = "TEST" | ||
'(or [Category Name] in version 2.0) | '(or [Category Name] in version 2.0) | ||
MyTable![Description] = | MyTable![Description] = "Still being updated" | ||
MyTable.Update</pre></blockquote> | MyTable.Update</pre></blockquote> | ||
<blockquote><pre> MySnap.MoveFirst | <blockquote><pre> MySnap.MoveFirst | ||
Debug.Print | Debug.Print "Category Name", , "Description" | ||
Do While Not MySnap.EOF | Do While Not MySnap.EOF | ||
Debug.Print MySnap![CategoryName], , MySnap![Description] | Debug.Print MySnap![CategoryName], , MySnap![Description] | ||
Line 69: | Line 69: | ||
<li><p>Add the following function to the module you created in step 2 of the previous procedure:</p> | <li><p>Add the following function to the module you created in step 2 of the previous procedure:</p> | ||
<blockquote><pre> Public Function NoUdate()</pre></blockquote> | <blockquote><pre> Public Function NoUdate()</pre></blockquote> | ||
<p>NOTE: In Microsoft Access version 2.0 do not use the word | <p>NOTE: In Microsoft Access version 2.0 do not use the word "Public" in front of the function name.</p> | ||
<blockquote><pre> Dim MyDB As Database | <blockquote><pre> Dim MyDB As Database | ||
Dim MyTable As Recordset | Dim MyTable As Recordset | ||
Dim MySnap As Recordset</pre></blockquote> | Dim MySnap As Recordset</pre></blockquote> | ||
<blockquote><pre> Set MyDB = CurrentDb() | <blockquote><pre> Set MyDB = CurrentDb() | ||
Set MyTable = MyDB.OpenRecordset( | Set MyTable = MyDB.OpenRecordset("Cat", dbOpenTable) | ||
Set MySnap = MyTable.OpenRecordset(dbOpenSnapshot)</pre></blockquote> | Set MySnap = MyTable.OpenRecordset(dbOpenSnapshot)</pre></blockquote> | ||
<blockquote><pre> MySnap.MoveLast</pre></blockquote> | <blockquote><pre> MySnap.MoveLast</pre></blockquote> | ||
<blockquote><pre> MyTable.AddNew | <blockquote><pre> MyTable.AddNew | ||
MyTable![CategoryName] = | MyTable![CategoryName] = "TEST" | ||
'(or [Category Name] in version 2.0) | '(or [Category Name] in version 2.0) | ||
MyTable![Description] = | MyTable![Description] = "Still being updated" | ||
MyTable.Update</pre></blockquote> | MyTable.Update</pre></blockquote> | ||
<blockquote><pre> MySnap.MoveFirst | <blockquote><pre> MySnap.MoveFirst | ||
Debug.Print | Debug.Print "Category Name", , "Description", Chr(13) | ||
Do While Not MySnap.EOF | Do While Not MySnap.EOF | ||
Debug.Print MySnap![CategoryName], , MySnap![Description] | Debug.Print MySnap![CategoryName], , MySnap![Description] | ||
Line 99: | Line 99: | ||
----- | ----- | ||
<blockquote>THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED | <blockquote>THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.</blockquote> | ||
''<span>©1997 Microsoft Corporation. All rights reserved.</span> <span>Legal Notices</span>.<br /> | ''<span>©1997 Microsoft Corporation. All rights reserved.</span> <span>Legal Notices</span>.<br /> | ||
'' | '' |
Latest revision as of 09:26, 20 July 2020
INF: Snapshot and Underlying Table Updated Until Snapshot FullArticle ID: Q103402
SUMMARY
A snapshot, along with its underlying table, continues to update until the snapshot is completely filled with data. The link to the snapshot's underlying table is continued until you move to the end of the snapshot's recordset. When you first create a snapshot recordset, memory is allocated to store data. In order to optimize memory, Microsoft Access does not load all the table's records at once, meaning that you have only a partial recordset in memory. When you move to the end of the snapshot, the link is then cut from the live table. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications" manual. NOTE: Visual Basic for Applications (used in Microsoft Access for Windows 95, version 7.0) is called Access Basic in version 2.0. MORE INFORMATION
The second function, NoUdate(), also creates a snapshot of a table, moves to the end of the snapshot, adds a new record to the table, and then prints the snapshot. In this example, the snapshot does not include the new record since the MoveLast command is executed before the new record is added. Function Udate()
Function NoUdate()
Note that because the snapshot was filled (MoveLast was executed) before the new record was added, the snapshot does not contain the new record added to the Cat table. |
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.
Additional reference words: 2.00 7.00 tables snap shot
KBCategory: kbprg
KBSubcategory: PgmObj