Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check if a record has been entered in the past 3 months 1

Status
Not open for further replies.

din2005

Programmer
Mar 22, 2005
162
GB
Hi is there any way by code to find a record by patients Name and to check if it was entered in the past three months using that criteria

p.s
I have an tblAppointments and there is field called appointmentDate.

thanks
 
[tt]DMax()[/tt]? You could include it in a function like:
Code:
Function SeenInLastThreeMonths([b]PatientName[/b] As String) As Boolean
Dim dteLast as Date
dteLast = DMax("appointmentDate", "tblAppointments", "[i]PatientNameField[/i]='" & [b]PatientName[/b] & "'")
If DateDiff("m", Date, dteLast) <= 3 Then
   SeenInLastThreeMonths = True
Else
   SeenInLastThreeMonths = False
End If
End Function

Hope this helps,
CMP


I am sorry I have not succeeded in answering all of your questions.
In fact, I apologize for not completely answering any of them.
The answers I have however do serve to raise a whole new set of questions I had not previously thought of. In some ways, I am as confused as you are but I believe my confusions are (as always) on a higher plane and
 
Simpler version of previous post:
Code:
Function SeenInLastThreeMonths(PatientName As String) As Boolean
SeenInLastThreeMonths = (DateDiff("m", Date, DMax("appointmentDate", "tblAppointments", "PatientNameField='" & PatientName & "'")) <= 3)
End Function

[pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top