Re: limit record on continous subform



it is working perfectly on an edit mode of the subform but when i added new
record on my main form
my sub cannot add record
please help

thanks arvin

Arvin Meyer [MVP] wrote:
So copy and paste this exact code into your subform's code window and
compile the code (Debug >>> Compile):

Private Sub Form_Current()
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
If rst.RecordCount > 8 Then
Me.DefaultEditing = 4
Else
Me.DefaultEditing = 2
End If
End Sub

If you get any error, you may have to set a reference to DAO. Do that by
going to Tools >>> References and finding Microsoft DAO 3.6 Object Library.
Check the box next to it and everything should work fine.
thanks for the immediate response

[quoted text clipped - 15 lines]

how can i limit a number of record in a continous subform

--
" So be it"

Message posted via http://www.accessmonster.com

.



Relevant Pages

  • Re: Error 3048 "Cannot open any more databases"
    ... I'm not sure where the code above runs - is it the main form or the subform? ... check the filter string to see if it looks OK ... Private Sub Form_Current ... Dim rst As DAO.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: Unbound subform is reset
    ... Private Sub cmdAssign_Click ... The main form and subform log the Open, Load, and Current events. ... The command button reassigns the subform's RecordSource. ... I keep a reference to the subform like this ...
    (microsoft.public.access.forms)
  • RE: error 3162 in text box
    ... or the Tool Number on the sub form? ... that once you move to the subform, the database will attempt to update the ... any other data type, ... and After Update events of the control where you enter a new job number. ...
    (microsoft.public.access.formscoding)
  • Re: adding new (blank) record to child/sub-form on main form
    ... subform "Evaluations" appears. ... Private Sub AddAudit_Click ... Private Sub Form_AfterUpdate ... > subform object in the database window on the Forms tab is Evalualtions. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Reference subform controls
    ... You reference fields on your sub form like this ... > searching the forum has identified that a subform is actually a *control*. ...
    (microsoft.public.access.formscoding)