sub Form does not allow additions 
Author Message
 sub Form does not allow additions

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



Tue, 19 Oct 2004 06:10:18 GMT  
 sub Form does not allow additions
Check the subform to ensure that its AllowAdditions propery is set to Yes.

Quote:
> 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



Tue, 19 Oct 2004 05:31:07 GMT  
 sub Form does not allow additions
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"

Quote:

>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



Tue, 19 Oct 2004 16:21:18 GMT  
 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



Tue, 19 Oct 2004 22:51:22 GMT  
 sub Form does not allow additions
Yep, good idea.

- Steve Schapel, Microsoft Access MVP

On Fri, 3 May 2002 10:51:22 -0400, "Dirk Goldgar"

Quote:

>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.



Wed, 20 Oct 2004 02:58:58 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. sub Form does not allow additions

2. how do you allow additions in a sub form

3. My forms will not allow additions and my tables get a + column

4. Linked SQL tables not allowing additions in Access forms

5. Add new Rec's to a Sub frm when Allow Additions = False

6. undo form additions with sub-forms

7. Do not allow addition

8. not Allowing Additions on subforms

9. Subform Not allowing addition of record

10. Form won't allow edits or additions


 
Powered by phpBB® Forum Software © phpBB Group