*

VB Database: Challenge Lab Week 6

Yay! I take it this means you survived Challenge Lab 5 and didn't get voted off the island...er, wrong scenario...

You've actually done most of the work on the Login form.  The rest will be partly a review of what you did in Week 4 with the Users form, and, of course, there's some new stuff.  Fun new stuff!...

So, here's what I want you to do to the Login form:

  • Change the DAO data control to an ADO data control (yes, you knew that one was coming - just like in Week 4).  If you have questions, refer to the Week 4 Challenge Lab post.  And you don't have to worry about binding the UserID/UserName and Password boxes, so that's less work than in Week 4 :-)
     
  • Because DAO and ADO are different, this will mess up your existing code.  (Would you expect anything else??) 
    • Instead of using Seek, I'm going to have you requery the table with a SQL string, passing in the UserID/UserName as criterion.  This will give you some more SQL practice. Remember to pay attention to the CommandType property.

      Hint: an empty recordset would be indicative of a no-match situation. 
       
    • Remember that the ComboBox you coded in Week 5's Lab is pulling from the data control, too.  And requerying does change the recordset...

That's about it for the Login form.  Now, something really fun!!  This will be on the Main form...

Access databases get bloated very easily, especially if one doesn't close the recordsets (it doesn't always get done automatically, even if the variable goes out of scope).  So, you may want to include code to compact the database automatically when the user exits the application.

  • With the help of this KB article and the interesting statements Kill and Name, code this automatic compaction in the unload of the Main form.

I've attached a proposed solution.  It has my modified Main form using the Resource file.  As always, please let me know if you have any questions.



Internet Content Rating Association

Alrak's Course Resources ©2002-2007 Karla Carter. All rights reserved. This material (including, but not limited to, Mini-lectures and Challenge Labs) may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact Karla.