J
JWCrosby
I have a contact management database based mostly on the Contact Management
wizard that comes with Access 2003. The table of Contacts has a ContactID
field (primary) and the Calls table has the list of call details, including a
date field (linked on the ContactID field).
On the main form that shows all the info about the contact, I want a field
that will show the date of the last contact, which would be the most recent
date in the Calls table associated with that Contact.
The original developer had used a public function (below) that used the
DLast function to return that date, but it doesn't seem to be working
consistently correctly. I'm assuming there's a better way, but I've reached
the limitation of my knowledge of Access to know what it is.
Public Function LastDate(CID)
Dim mydate
On Error GoTo errout
mydate = DLast("CallDate", "tblCalls", "[ContactID] =" & CID)
If IsNull(mydate) Then
LastDate = "None"
Else
LastDate = DateValue(mydate)
End If
errout:
End Function
Can someone help get me out of the dark?
Thanks in advance.
Jerry
wizard that comes with Access 2003. The table of Contacts has a ContactID
field (primary) and the Calls table has the list of call details, including a
date field (linked on the ContactID field).
On the main form that shows all the info about the contact, I want a field
that will show the date of the last contact, which would be the most recent
date in the Calls table associated with that Contact.
The original developer had used a public function (below) that used the
DLast function to return that date, but it doesn't seem to be working
consistently correctly. I'm assuming there's a better way, but I've reached
the limitation of my knowledge of Access to know what it is.
Public Function LastDate(CID)
Dim mydate
On Error GoTo errout
mydate = DLast("CallDate", "tblCalls", "[ContactID] =" & CID)
If IsNull(mydate) Then
LastDate = "None"
Else
LastDate = DateValue(mydate)
End If
errout:
End Function
Can someone help get me out of the dark?
Thanks in advance.
Jerry