
sub Form does not allow additions
An alternative might be just to have an "Add Copy" button on the main form
that, when clicked, executes an append query to create a new record in the
PublicationCopies table, and then requeries the subform.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Quote:
> Jonathan,
> I think you will not be able to do this. You cannot create a new
> record on a subform under these circumstances, where both of your only
> 2 fields are not user-modifiable. Apart from entering the data via a
> standalone form rather than a subform, the only way I can think of is
> to add another field to your PublicationCopies table, which will
> contain nothing of any use except to make your record editable. You
> don't have to have a visible control on the subform for this. Then,
> instead of using the navigation buttons, put a little command button
> on your subform, and assign a macro or code to enter a arbitrary value
> in the RecordMaker field, and then going to a new record. Using a
> macro, it would be the SetValue action. Using VBA, it would look
> something like...
> Me.RecordMaker = "X"
> DoCmd.GoToRecord , , acNewRec
> - Steve Schapel, Microsoft Access MVP
> On Fri, 3 May 2002 00:10:18 +0200, "Jonathan Black"
> >Access 2000
> >I have a form which has a form and a subform within it.
> >The table in the main form's source table is called PublicationDetails.
> >The primary key is PublicationSerialNumber.
> >The subform's source table is called PublicationCopies and it has two
> >fields.
> >One is CopyID which is an autonumber primary key.
> >The second is PublicationSerialNumber which is a foreign key from the
> >PublicationDetails table. It's locked property is set to true.
> >The relationship is one to many with referential integrity and cascading
> >deletes set to true.
> >The join is set so that all records are displayed in the
PublicationDetails
> >Table but only records which are equal are displayed in the
> >PublicationCopies Table.
> >The subform field linker shows Master Fields and SubFields to be
> >PublicationSerialNumber
> >Now all I want is that if there are extra copies of the publication the
user
> >can go down to the subform and just click on the navigation bar button to
> >add a record, but this button is greyed out.
> >Note that one field in the subform is an autonumber and the other is a
> >primary key, so the user would not fill anything out, but just add the
> >record.
> >Thanks
> >Jonathan