title: I am getting a C++ runtime error while running access vba module. Consistently reproducible
body: <p>I have taken 2 sample databases from online - one for a calendar and one for drag and drop functions - and pulled some code together for a result that is ALMOST functioning as I had hoped.</p>
  <p>There is a function to build/refresh the calendar, which works perfectly.
  The drag and drop functions work perfectly. (The item is updated in the table to reflect the new date.)</p>
  <p>When I drag and drop, the calendar doesn't automatically refresh. If I click next month then last month (which call the refresh function with a new date), the changes are reflected as expected.</p>
  <p>The problem is when I try to automatically call the refresh function after a drag/drop event. Access crashes every time I call for a refresh in the code after drag/drop, regardless of where I put the call.</p>
  <p>The error says:</p>
  <blockquote>
  <p>Microsoft visual C++ Runtime Library</p>
  <p>Runtime Error!</p>
  <p>Program: C:...</p>
  <p>This application has requested the Runtime to terminate it in an
  unusual way. Please contact the application's support team for more
  information.</p>
  </blockquote>
  <p>I have tried:</p>
  <ul>
  <li><p>I thought it might be trying to refresh too fast, so I added a pause
  function and had the program wait 10 seconds after dropping before
  refreshing. Still crashed.</p>
  </li>
  <li><p>I did a compact and repair on the database.</p>
  </li>
  <li><p>I ran /decompile from the command-line on my accdb file.</p>
  </li>
  <li><p>I exported the relevant form, tables, query and module to a new accdb
  file.</p>
  </li>
  <li><p>I have tried to re-register the libraries checked under references.
  (RegSvr32 &quot;Path to library file&quot;) The only one that succeeded was
  vbe7.dll. The &quot;MS access 14.0 object library&quot;, &quot;OLE automation&quot;, and
  &quot;MS Office 14.0 Access Database Engine Object&quot; don't contain a
  DllRegisterServer method, so regsvr32 did not succeed with those. There are no other
  references checked. Still crashes.</p>
  </li>
  <li><p>I have tried countless places to insert the call to refreshcalendar()</p>
  </li>
  <li><p>I have stepped through the code and verified the exact place that the
  crash happens. It is commented in the code.</p>
  </li>
  </ul>
  <p>Here is a <a href="https://drive.google.com/file/d/0B091dbVn-ZlnNjZQZ3JTRW9SVXM/edit?usp=sharing" rel="nofollow noreferrer">link to the database</a>.</p>
  <p>To reproduce the problem:</p>
  <p>Open frmsubCalendar.
  There are 2 entries in May 2014 that can be dropped to other days on the calendar. I can then click the prev/next month buttons on the form, and when May reloads, the change has been made. But if I go into mod_drag_drop under the sub dropdetect() and uncomment the lines noted in the comments, the refresh will crash access at the end of the dropdetect() sub.</p>
  <p>I cannot figure out how to make the calendar refresh automatically after a drag/drop event without access crapping the bed.</p>