Initial

  • Thread starter Thread starter casih
  • Start date Start date
C

casih

I have a form containing personal details. Included in this form are fields
First Name, Initial & Surname. Is there anyway that Once I have entered a
first name in the box access will automatically enter the initial for me.
i.e. Entering "Casi" would ensure that the "Initial" is filled in with C?
 
In the After Update event of the Firstname field put this code

If Len(Me.Firstname & "") > 0 Then
Me.Initial = Left(Me.Firstname,1)
End if
 
Most folks would use a field named Initial for the middle name initial.
There is no need to have a field for first name initial as it can be pulled
by Left([FName],1) to extract the first letter of the first
name.
 
On Fri, 21 Aug 2009 06:10:01 -0700, casih

Yes. Write this in the firstname control's AfterUpdate event:
myInitial.Value = Left$(myFirstName,1)
(of course you replace myObjectNames with yours)

This will populate the Initial field, but also allow you to override
it. If overriding is never needed, the Initial field is not needed
because it can be calculated.

-Tom.
Microsoft Access MVP
 
I have tried entering this code but keep getting the error message Block if
without End If) - Help!!!
 
I have tried entering this code but keep getting the error message Block if
without End If) - Help!!!

Post your COMPLETE code. The three lines below are OK - there must be an error
elsewhere.
 
Back
Top