stepping through code vs. continue

M

Mary Fran

I am baffled - why does my code work when I step through it but as soon as I
remove break and run it doesn't? Here is the code:
DoCmd.OpenForm "frmNewStudents", , , , , acHidden
DoCmd.OpenForm "frmNewStudentsPrevious", , , , , acHidden
Set dbNew = Forms!frmNewStudents.Recordset.Clone
Set dbPrevious = Forms!frmNewStudentsPrevious.Recordset.Clone
If dbPrevious.RecordCount <> dbNew.RecordCount Then
....
Even when the 2 values are equal it runs the code for them being <> when I
remove the break - please help!!!
 
K

Ken Ismert

Mary:

Unless both forms are using Snapshot-style recordsets, you will have to
move to the end of the recordset to get an accurate record count.

Try this:
....
dbPrevious.MoveLast
dbNew.MoveLast
If dbPrevious.RecordCount <> dbNew.RecordCount Then
....

-Ken
 
Top