"(PeteCresswell)" <x@y.Invalidwrote in
news:plprf2pqvaqks2nbldbbgh9e12shjtt4ga@4ax.com:
Quote:
Per David W. Fenton:
Quote:
>>Setting the form to allow additions should give you at least one
>>record. You can disable the control so the user can't type until
>>they've initiated a legal add.
>
You mean disabling the subform control that has the offending form
as it's .SourceObject, right?
That's probably the way I'd do it, though others might disable the
controls on the form.
Quote:
I never would have thought of that - and it sounds like the
simplest solution.... even to the point of implementing across all
of my forms/subforms because occurrence of the problem would seem
tb data-dependent and therefore lurking in other forms/subforms.
i.e. avoiding it depends on a given subform having records
behind it..
I'm surprised you haven't encountered this often enough before to
have hit on this solution before.
Another solution is setting the recordsource to something that
returns one Null record. I do this a lot in forms that I want to
open with no records loaded. The basic method is to do a SELECT TOP
1 on the table with the least records, and make all the fields Null,
something like this:
SELECT TOP 1 Null As FirstField, Null As SecondField
FROM [table]
The result is that your bound controls all show Null, are uneditable
and you have only one record, and you don't have to worry about
setting AllowAdditions.
I've never done it in a subform, though -- only in a parent form.
--
David W. Fenton
http://www.dfenton.com/
usenet at dfenton dot com
http://www.dfenton.com/DFA/