Event for Updating field in New Record, based on field value ?

liamfitz

Registered User.
Local time
Today, 21:44
Joined
May 17, 2012
Messages
240
The following code I was hoping, would write to another field in the newly created record, entered on sub-form, There are only 2 events listed, associated with the subform ( one being the 'Exit' used here ) The procedure doesn't run, as checked, by using 'Dim x' etc. to check.

Code:
Private Sub sfrmRefs_Exit()
Dim x As Integer
x = 0
Dim dt As Date
Dim IdString As String
x = 1
With Me!sfrmRefs.Form.Recordset
    .Edit
    ' Store entered referral date in variable - dt
    dt = !Referral_Date
    ' Create concatenated string for new Referral_ID, from Client_ID, Client initials and ref_date
    IdString = CStr(cl & Left(Me!Parent!txtForename.Text, 1) & Left(Me!Parent!txtSurname.Text, 1) & Format(dt, ddmyy))
    Me!Parent!txtTest.SetFocus
    Me!Parent!txtTest.Text = IdString
    !Referral_ID = IdString
    .Update
End With
End Sub

It doesn't execute.
 

Users who are viewing this thread

Back
Top Bottom