verify all subforms have records

D

deb

Access 2003

I have a form called f001ProjectReview (PK ProjectID) it has several
subforms linked by ProjectID. Sub1, Sub2, Sub3.
There is a button that activates a pop up form called fClosureApprovalPopUp
linked by ProjectID.

On fClosureApprovalPopUp I have an approval button. When user clicks the
approval button I need to verify that all subforms on f001ProjectReview have
records. If there is a subform that does not have a record then display
message that required data is missing and exit without saving.

Your help is greatly appreciated!!
 
S

S.Clark

You could use Recordsetclone to populate a recordset based on the data in the
subform, then check the count.
or
Use DCount() against the datasource that the subform is based.
 
D

deb

I used... I hope it is the correct way to accomplish this.

If Forms![fClosure]![fClosureUnits].Form.RecordsetClone.RecordCount = 0 Or _
Forms![fClosure]![fClosureOrd].Form.RecordsetClone.RecordCount = 0 Or _
Forms![fClosure]![fClosureContr].Form.RecordsetClone.RecordCount = 0 Or _
Forms![fClosure]![fNotes].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "All information must be complete on Closure Form. ",
vbOKOnly, "Project Manager Verify"
Me.PMApprove = ""
DoCmd.Close
Exit Sub
End If
 

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