Code which worked before stopped working (now runtime error 429)

B

Boris

On some computers (of course only at the client :) this VBA code throws
error 429:

Me![cmdButton].Enabled = Me![subForm].Form.Recordset.RecordCount > 0

This code is used in Form_Current(). The idea is that a button on the form
should only be enabled if there is at least one record in a subform.

This code works on my computer (Access 2003) and also worked for a long time
on the computers of the client (Access 2002 and Access 2003). For some
reason this line stopped working now. While the error is caught in Access
2003 I've seen Access 2002 sometimes even crashing.

I don't know if the client changed the configuration and/or installed new
programs. Does anyone have an idea why this code might not work and what
might cause runtime error 429? Could this be a race condition as the number
of records of a subform is checked while Form_Current() is executed? Or
could it be related with DAO?

Boris
 
A

Allen Browne

Try referring to the RecordsetClone of the form rather than its Recordset:

Me![cmdButton].Enabled = Me![subForm].Form.RecordsetClone.RecordCount > 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top