Subform record count check

Access 97/2000/2003

From a Command button...


I have a subform that I'am getting data from and posting onto my main form..

In the Subform I need to see if the record count > 0  before I do this.

Need a msgbox to say ...  "Zero records. Try Again"



Private Sub cmdPost_Click()

' AUTO POSTING IF VALUES IN SUBFORM
 Dim strForm As String
strForm = "qryBarnes subform"
Dim z
Me.qryBarnes_subform.SetFocus
z = nextTextPost(Me.Controls(strForm)![CompetitorNumber] & "|" & Me.Controls(strForm)![tblXrefSku.Grng] & "|" & Me.Controls(strForm)![Noun] & " " & Me.Controls(strForm)![Size] & "|" & " |" & Me.Controls(strForm)![CompetitorName] & "|" & Me.Controls(strForm)![CompetitorNumber])
Me.fldMfrnum.SetFocus
End Sub

Thanks
fordraiders

LVL 3
FordraidersAsked:
Who is Participating?
 
Leigh PurvisDatabase DeveloperCommented:
If Me("qryBarnes_subform").Form.Recordset.RecordCount>0 Then
    'Do your stuff

End If

(Post 97 only.  Otherwise...
If Me("qryBarnes_subform").Form.Recordsetclone.RecordCount>0 Then
)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.