How to limit input data on the same month for each patient? The field is a data/text box on a subform
I found this code on Form Current Event!:
But I want a monthly limit
I found this code on Form Current Event!:
Code:
[COLOR=#E56717][B]Private[/B][/COLOR] [COLOR=#E56717][B]Sub[/B][/COLOR] Form_Current() [COLOR=#151B8D][B]Dim[/B][/COLOR] intMaxNumRecs [COLOR=#151B8D][B]as[/B][/COLOR] [COLOR=#F660AB][B]Integer[/B][/COLOR] intMaxNumRecs = 5 [COLOR=#008000]'Max Number of Records to Allow [/COLOR] [COLOR=#8D38C9][B]If[/B][/COLOR] Me.NewRecord [COLOR=#8D38C9][B]Then[/B][/COLOR] [COLOR=#8D38C9][B]With[/B][/COLOR] Me.RecordsetClone [COLOR=#8D38C9][B]If[/B][/COLOR] .RecordCount > 0 [COLOR=#8D38C9][B]Then[/B][/COLOR] .MoveLast: .MoveFirst [COLOR=#8D38C9][B]If[/B][/COLOR] .RecordCount >= intMaxNumRecs [COLOR=#8D38C9][B]Then[/B][/COLOR] MsgBox [COLOR=#800000]"Can't add more than "[/COLOR] & intMaxNumRecs & [COLOR=#800000]" records in the demo database!"[/COLOR] .MoveLast Me.Bookmark = .Bookmark [COLOR=#8D38C9][B]End[/B][/COLOR] [COLOR=#8D38C9][B]If[/B][/COLOR] [COLOR=#8D38C9][B]End[/B][/COLOR] [COLOR=#8D38C9][B]If[/B][/COLOR] [COLOR=#8D38C9][B]End[/B][/COLOR] [COLOR=#8D38C9][B]With[/B][/COLOR] [COLOR=#8D38C9][B]End[/B][/COLOR] [COLOR=#8D38C9][B]If[/B][/COLOR] [COLOR=#8D38C9][B]End[/B][/COLOR] [COLOR=#E56717][B]Sub[/B][/COLOR]
But I want a monthly limit
Last edited: