After Update? if so how

A

austin

There is a table with four columns:
Contact ID, Contact Date, Comments, and Follow Up Date

Can you have a new record start automatically after data is entered into the
Follow Up Date column with the corresponding ID and have the Follow Up Date
become the new Contact Date?

thanks
 
P

pietlinden

There is a table with four columns:
Contact ID, Contact Date, Comments, and Follow Up Date

Can you have a new record start automatically after data is entered into the
Follow Up Date column with the corresponding ID and have the Follow Up Date
become the new Contact Date?

thanks

If you're entering data directly into the table, then no. Otherwise,
you can use form-level events to do this.

create a variable to copy the ID.
copy id to variable (MyVariable=Me.Fields("Follow Up Date")
Add a new record
Me.Fields("Contact Date")=MyDate
 
K

Ken Sheridan

Provided the data is entered via a form. In the AfterUpdate event procedure
of the Follow Up Date control put the following code:

Dim lngContactID As Long
Dim dtmDate As Date

' store Contact ID and Follow Up Date in variables
lngContactID = Me.[Contact ID]
dtmDate = Me.[Follow Up Date]

' save current record
RunCommand acCmdSaveRecord

' move to new record and assign
' values of variables to controls
DoCmd.GoToRecord acForm, Me.Name, acNewRec
Me.[Contact ID] = lngContactID
Me.[Contact Date] = dtmDate

I've assumed that Contact ID is a long integer number data type.

An alternative approach would be to execute an SQL statement in code to
insert a new row, with the relevant values in the two columns, into the
underlying table.

Ken Sheridan
Stafford, England
 
Top