Avatar of Michael Dean
Michael Dean
Flag for United States of America asked on

Form Processing in Access

I would like to add a a condition to this,


While the user is creating a new record, there is a field on the form called "ServiceType"  if they select 'Legal' I would like to append a "L" at the end of the FileNo, else
leave everything the same as below


Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
    Me.FileNo = Year(Date) & "1" & Format(Me.InvoiceID, "00000")
End If
End Sub
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
ste5an

Please embed code into [code] tags (the CODE button). You can edit your post.

E.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)
  
  If Me.NewRecord Then
    Me![FileNo] = Year(Date) & "1" & Format(Me![InvoiceID], "00000") & Left(Me![ServiceType], 1)
  End If

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck