Limit Continuous Forms Records

  • Thread starter Thread starter bret.
  • Start date Start date
B

bret.

Hello,

I have a subform which is set to continuous forms (its
relationship is many) and want to limit the total records
to 3.

Can anyone offer direction or reference on how to achieve
this?

thank you.

bret.
 
thanks for the comments but I just used a 'if 'statement
in the onclick of a command button to check the qty of
records already assigned to the styleid.

thanks


Function mLine(strID As String)
On Error GoTo ErrHandler

Dim rst As DAO.Recordset, dbs As DAO.Database
Dim strSQL As String, strReturn As String

Set dbs = CurrentDb

strSQL = "SELECT tbl_facecard_Bias.STYLEID, Count
(tbl_facecard_Bias.STYLEID) AS [Count]" & vbCrLf & _
"FROM tbl_facecard_Bias" & vbCrLf & _
"GROUP BY tbl_facecard_Bias.STYLEID" &
vbCrLf & _
"HAVING (((tbl_facecard_Bias.STYLEID)=" &
strID & "));"

Set rst = dbs.OpenRecordset(strSQL,
dbOpenDynaset, dbReadOnly)
If rst.BOF = False And rst.EOF = False Then
rst.MoveFirst

mLine = rst!Count

Else
mLine = Null
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

Exit_ErrHandler:
Exit Function
ErrHandler:
'Debug.Print Err.Description & ", " & Err.Number
Resume Exit_ErrHandler
End Function
 
Back
Top