Required Multiple Records in Sub Form

Slimjimmpc

Registered User.
Local time
Today, 06:37
Joined
Jan 22, 2011
Messages
12
Two problems. Using Access 2000

1. I need the user to be able to enter 15 records in my subform and only 15.

Currently using this bit of code to limit adding 15 records and it works.

If Me.RecordsetClone.RecordCount > 14 Then
Me.AllowAdditions = False
End If

What i need is a way so the user must enter the 15 record for the yes/no combo box column before closing the form. They have to enter 15 yes/no as it is a checklist.

2. How do i get it so they have to enter information into the main form first before adding anything to the subform? If a field is required to link it such as say Site that wouldn't be problem.


Any help would be greatly appreciated. Thanks
 
The subform control should have 2 properties for the controls used to link the main & sub forms.

As for requiring 15 records to close the form, you could remove the close button on the form (in form properties) and add a command button which is disabled. Then add a line of VBA code within the If statement you posted to unhide it when 15 records have been created.
 
The subform control should have 2 properties for the controls used to link the main & sub forms.

As for requiring 15 records to close the form, you could remove the close button on the form (in form properties) and add a command button which is disabled. Then add a line of VBA code within the If statement you posted to unhide it when 15 records have been created.

Where is this subform control?
I have looked through the properties windows.


As for the code do you know the command to use?
 
Open the main form in design view and click something on the main form (the header, a control, whatever). Click once onto the subform and look at the properties window, you should have the subform object selected rather than the form it contains.

As for the VBA code to add, it will depend on the form names but something along the lines of:
Code:
Forms!MainFormName!SubFormControlName.Visible = True
 
-or-
 
Me!SubformControlName.Visible = True
 
-or-
 
SubformControlName.Visible = True

The first will work from any form as it has a full reference to the subform control, the second and third require the code to be in the main form (i.e. in an event on the main form or one of the controls in the main form).

:edit:

Here is a link to a screen-print I took when explaining how to select a subform to another user: http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=35484&d=1295972221
 

Users who are viewing this thread

Back
Top Bottom