log a call - incremental numbers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All.
I have to create a database for our telemarketing team where they can log
in/outbound calls against a contact. I have a parent form called
CONTACT-HISTORY and a child or subform called CALL_HISTORY, these are liknked
by the PROSPECTID field. There is a field called ATTEMPTNUMBER that is used
to log how many calls have been made to this contact, but it isn't an
autonumber.
What i need to happen is each time a call to or from the contact on screen
is made, the agent creates a record in CALL_HISTORY and the ATTEMPTNUMBER
field is incremented by 1.
I am sure it is to do with the DMAX function but don't quite understand it.
I would really appreciate your expert help.
Thanks.
 
You are correct about the DMax. Here is the formula:
I will have to make up a table name. You did provide form names, but you
don't need to worry about that. Where I use MyTableName, substitiute the
name of your table and Substitiue MyFieldName with the name of the field in
the table. I believe you mean ATTEMPTNUMBER is a control (forms don't have
fields, tables have fields) on your form:
Me.ATTEMPTNUMBER = Nz(DMax("[MyFieldName]", "MyTableName","[ProspectID] =
Me.ProspectID ),0) + 1

When you place the first call to a prospect, there will be no call record
for that Prospect, so the DMax will return Null, the Nz function will convert
the Null to 0.
 
Back
Top