dao error (3420)

geekhead83
04-14-2004, 12:00 PM
i have a dao control which connects to a access database.
i have a recordcount statement (in a command button)to count the number of records in a table from the database.
when i run the prog, the no. of records are counted correctly and i get a message box (i have put this). if i press cancel on the message box and press the command button, i get the foll eror "Object is invalid or no longer set. (Error 3420)".

the problem is with the recordcount statement. now what do i do.
the first time, the prog runs, but if it is run again (without unloading the form), the above error occurs.

MKoslof
04-14-2004, 04:26 PM
We would need to see you code in order to provide more assistance. Can you post it?

geekhead83
04-14-2004, 10:48 PM
yeah..... here it goes :

Private Sub cmdcal_Click()

drumdiacount = datdrumdia.Recordset.RecordCount



when i press the cmdcal button the first time, everything runs fine.
but when i run it the second time (without reloading the form), the above statement returns the mentioned error.

wengwashere
04-15-2004, 12:25 AM
its either :
You have already closed the recordset object and/or set it to nothing

or

You havent initialized the recordset object (SET obj = new recordset)

geekhead83
04-15-2004, 08:47 AM
well i found a quick soln. i removed the statement which counted the recordset, intialized the variable to '20' and then included an error handling statement for the error 'no current record' (as the no. of records in the database table are only 13).

hope u get it.thanx every1!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum