|
Question : 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
|
|
Answer : Subform record count check
|
|
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 )
|
|
|