Restrict number of records in a form

R

Rex

Hi,

In my access database I would like to restrict user from entering more
than specific number of records. for example, I have a table Family,
which has a one-to-many relationship with another table called Twin. In
the form I would like to restrict the user from entering more than two
twin records for each particular family.

Cheers
Rex
 
A

Arvin Meyer [MVP]

In the form's Current event, something like:

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
If rst.RecordCount > 2 Then
Me.DefaultEditing = 4
Else
Me.DefaultEditing = 2
End If
 
R

Rex

Would this work like this: for family ID 1, I will be able to enter 2
records and when I move on to next family ID, which is 2. It should be
able to add another two records for familyID 2
 
A

aaron.kempf

you can limit the # of records in an Access Data Project without a
problem

what is it the .maxrecords method?

Thanks

-Aaron
 
A

Arvin Meyer [MVP]

If you're using a subform, with the mainform showing a single FamilyID it
would be referred to like:

Me.NameOfSubformControl.Form.RecordsetClone
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top