[COLOR="Navy"]Private[/COLOR] [COLOR="Navy"]Sub[/COLOR] Text1_BeforeUpdate(Cancel [COLOR="Navy"]As[/COLOR] Integer)
[COLOR="Navy"]Dim[/COLOR] rs [COLOR="Navy"]As[/COLOR] DAO.Recordset
[COLOR="Navy"]Set[/COLOR] rs = CurrentDb.OpenRecordset("SELECT Max([ID]) FROM Products;", dbOpenSnapshot)
[COLOR="Navy"]If[/COLOR] [COLOR="Navy"]Not[/COLOR] rs.EOF [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]If[/COLOR] CLng(Me.Text1.Value) <= rs.Fields(0).Value [COLOR="Navy"]Then[/COLOR]
Cancel = True
MsgBox "Error: ID must be greater than " & Format(rs.Fields(0).Value, "#,##0") & ". "
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
rs.Close
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]