Limit Number of records in a Subform

  • Thread starter Thread starter Nick1966
  • Start date Start date
N

Nick1966

Hi

I have a Main Form that displays the number of products received on any
particular order. The details of which are then entered into a subform. Is
it possible to set the properties of the sub form to display only enough
spaces for the number of products received i.e. if three products received
then only three records can be entered onto the sub form. I am using Access
2000 on WIN2K Pro


Cheers Nick
 
Nick1966 said:
I have a Main Form that displays the number of products received on any
particular order. The details of which are then entered into a subform. Is
it possible to set the properties of the sub form to display only enough
spaces for the number of products received i.e. if three products received
then only three records can be entered onto the sub form. I am using Access
2000 on WIN2K Pro

Try using the recordcount property of the subform's recordset in the
subform's OnCurrent event. Something like:

Dim rst As Recordset
Dim i As Integer
i = Me.ProductsReceived

Set rst = Me.recordsetclone
If rst.recordcount > i - 1 Then
Me.DefaultEditing = 4
Else
Me.DefaultEditing = 2
End If
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top