First initial only in field on form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Neekos
    New Member
    • Aug 2007
    • 111

    First initial only in field on form

    Hey guys,

    I have a table that is linked to an Excel spreadsheet that imports a few different fields such as last name, first name, etc...

    i also have a form(frmBook) with a subform(frmShee t) that reflects this info, but on the form i only want the first initial of the first name to show. So im using:

    Code:
    initial = Left([First name], 1)
    Forms![frmSheet]![First name] = initial
    how do i assign the value of initial to the FirstName field on the subform? I have my code in the OnOpen event of frmSheet, but it doesnt recognize it. I get an error saying "you cant assign a value to this object".

    Is it because the table is linked that i cant edit it? How do i work around this?
  • mlcampeau
    Recognized Expert Contributor
    • Jul 2007
    • 296

    #2
    Originally posted by Neekos
    Hey guys,

    I have a table that is linked to an Excel spreadsheet that imports a few different fields such as last name, first name, etc...

    i also have a form(frmBook) with a subform(frmShee t) that reflects this info, but on the form i only want the first initial of the first name to show. So im using:

    Code:
    initial = Left([First name], 1)
    Forms![frmSheet]![First name] = initial
    how do i assign the value of initial to the FirstName field on the subform? I have my code in the OnOpen event of frmSheet, but it doesnt recognize it. I get an error saying "you cant assign a value to this object".

    Is it because the table is linked that i cant edit it? How do i work around this?
    Instead of using VB to do this, why don't you just create a textbox on your subform with =Left([First name], 1) as the expression?

    Comment

    • Neekos
      New Member
      • Aug 2007
      • 111

      #3
      wow - i completely overlooked such a simple solution.

      Thanks!

      Comment

      • mlcampeau
        Recognized Expert Contributor
        • Jul 2007
        • 296

        #4
        Not a problem. Good luck!

        Comment

        Working...