home

Limiting Entries on a Subform

5/23/01 10:13:52 AM

This is a newsgroup message which explains how to limit the number of entries a user can enter into a subform.

The main form is based on a query called ActivePageantQry which has fields:

PageantID
PageantName
etc.

The subform built over table PageantPhase:

PageantPhaseID
PageantID
PhaseID
PageantScoringFactor
etc.

The link for the two forms is PageantID.

Everything works wonderful, I just want to limit the PageantPhase
portion to 4 entries. Any ideas?

Thanks in advance...

Eric Hill
J & E Designs, Inc.
Muscle Shoals, AL
hille@wlv.com

From Lee Johnson
One of the method is to use the TOP keyword in the Select statement. For example, the following query will only return 4 records: Select top 4 OrderID from Orders where EmployeeID = [ParentForm]!EmployeeID; If you use this method, do not link the main form and subform. Instead, set the Record Source property of the subform to the above query directly. Then in the main form's OnCurrent event, call subform's Requery method. Hope this helps.