Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only allow 1 record on a subform

Status
Not open for further replies.

cmmd2003

Programmer
Mar 23, 2007
28
GB
Is there a way that allows one subform record per parent record.

See attatchment
 
If you can only have one record then get rid of the subform. Bind the tables in a query by order ID. Now just add the fields to your main form in tabular fashion. The subform is not doing anything for you if you can not have more than 1 record.

If you can have more than 1 record, but this is a data entry form then set the subform to data entry, make it a single form view, and format the single form view as a tabular form (i.e. stack the labels on top). Remove the navigation buttons on the subform. You could probably do this with a continous form and some code, but I think you would see the new row but be unable to access it.
 
How are ya cmmd2003 . . .

From what you've shown, the 2nd record is the [blue]add new record line[/blue]. Set the subforms [blue]Allow Additions[/blue] property to [blue]No[/blue].

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
However setting the allow additions property to no prevents any records being added at all
 
cmmd2003 . . .

You could have your own [blue]command button[/blue] reset the property and on saving the record set it back.

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Set the ForeignKey in the child table to unique (ie NOT allowing duplicates).

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top