Upon opening a subform (datasheet), is there a quick way using on_current event to determine if no rows have been added? I want to turn allowadditions to be true or false to allow the addition of one row maximum. Thanks!
Are you sure?Trying that, but I'm learning that if there are NO records in the subform, On_Current doesn't get called at all!
Yes, you only need it one time, do you not?, just when there are no records for the current event to fire. Once you have a record, the current event will control your limits, when not, the Load event will control the limit.Form Load only works ONE time - but not if you point to a different master record. It's okay, I'll just do a recordset record count. Thanks!
I think the only way you would have no active controls is if the form has no records, AND the query is non updateable. If the query is updateable you would see the controls for the first (blank) row.Upon opening a subform (datasheet), is there a quick way using on_current event to determine if no rows have been added? I want to turn allowadditions to be true or false to allow the addition of one row maximum. Thanks!
If not myform.control("some control") is nothing
Then
'A record exists
Else
'No record
End if
dcount(me.recordsource)
That sounds like it's a bound form. In addition to all the gimmicks in the form, you can and should define important rules in the table and their definition - simply because, in addition to a bound form, there are other options for creating new records (=> recordsets, action queries, standard imports, manual operation). At the table level, protection and measures are more comprehensive and secure.I want to turn allowadditions to be true or false to allow the addition of one row maximum.