New to VBA excuse my ignorance - I've tried to solve the problem with DCount; however, this may not be correct solution - I'm open to suggestions:
Problem:
I have a form that Queries from table DATA_PERMIT sorting by WELLNAME, Agency etc. The current form only selects Agency = "ST". For reporting puporses, a display flag notes those records to be displayed in reports. A message needs remind users to uncheck prior flags for Type records "NP" or "RE". There may be many other [Type] which can have multiple displays but between NP and RE only one record can be marke with [Display]=true.
Private Sub Type_AfterUpdate()
If (DCount("[TYPE]", "DATA_PERMIT", [WELLNAME] = Me![WELLNAME] And Me![Agency] = "ST" And (Me![Type] = "NP" Or Me![Type] = "RE")) > 1) Then
MsgBox "Uncheck PRIOR RECORD Display Flag for New Permit or Refile"
Else
End If
--
The message does not appear for types other than NP or RE but the message appears anytime NP or RE is entered even if it is the only entry.
I don't know enough about VBA and can't read fast enough.
Can anyone help.
Much appreciated
Problem:
I have a form that Queries from table DATA_PERMIT sorting by WELLNAME, Agency etc. The current form only selects Agency = "ST". For reporting puporses, a display flag notes those records to be displayed in reports. A message needs remind users to uncheck prior flags for Type records "NP" or "RE". There may be many other [Type] which can have multiple displays but between NP and RE only one record can be marke with [Display]=true.
Private Sub Type_AfterUpdate()
If (DCount("[TYPE]", "DATA_PERMIT", [WELLNAME] = Me![WELLNAME] And Me![Agency] = "ST" And (Me![Type] = "NP" Or Me![Type] = "RE")) > 1) Then
MsgBox "Uncheck PRIOR RECORD Display Flag for New Permit or Refile"
Else
End If
--
The message does not appear for types other than NP or RE but the message appears anytime NP or RE is entered even if it is the only entry.
I don't know enough about VBA and can't read fast enough.
Can anyone help.
Much appreciated