A family of Microsoft relational database management systems designed for ease of use.
You cannot do that by means of a Validation Rule, but you can do so in the BeforeUpdate event procedure of a form for entering data into the Applications table, e.g.
Const MESSAGETEXT = "There is already an application for this month."
Dim strCriteria As String
strCriteria = "YEAR([ApplicationDate]) = " & YEAR(Me.[ApplicationDate] & _
" AND MONTH([ApplicationDate]) = " & MONTH(Me.[ApplicationDate]) & _
" AND [ApplicantID] = " & Me.[ApplicantID] & _
" AND [ApplicationID] <> " & Me.[ApplicationID]
If Not IsNull(DLookup("ApplicationID", "Applications", strCriteria)) Then
MsgBox MESSAGETEXT, vbExclamation, "Invalid Operation"
Cancel = True
End if
This will only provide validation when entering data via a form, however, which you might fell is adequate. It is still possible for invalid data to be entered in some other way. To protect against that you'd need to apply a CHECK CONSTRAINT to the table, which can be done in code, e.g. from the debug window, by entering the following, as a single line:
CurrentProject.Connection.Execute "ALTER TABLE Applications ADD CONSTRAINT OnePerMonth CHECK((SELECT COUNT(*) FROM Applications GROUP BY ApplicantID, YEAR(ApplicationDate), MONTH(ApplicationDate) HAVING COUNT(*) > 1) IS NULL)"
If you want too subsequently remove the constraint enter:
CurrentProject.Connection.Execute "ALTER TABLE Applications DROP CONSTRAINT OnePerMonth"
NB: Name of constraint, OnePerMonth in this example, must be distinct within the database.