Substring from Form Data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ReubenPatterson
    New Member
    • Jun 2007
    • 13

    #1

    Substring from Form Data

    I'd like to take the First 8 characters of the data a user inputs into a form and populate another hidden field with it for saving to the table. I know how to hide the field but not how to get the substring from user input...any suggestions?
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Originally posted by ReubenPatterson
    I'd like to take the First 8 characters of the data a user inputs into a form and populate another hidden field with it for saving to the table. I know how to hide the field but not how to get the substring from user input...any suggestions?
    [CODE=vb]

    Private Sub Text4_AfterUpda te()
    Me.Text4 = Left(Me.Text4, 8)
    End Sub

    [/CODE]

    Additional hidden field not needed.

    Good luck.

    Comment

    • ReubenPatterson
      New Member
      • Jun 2007
      • 13

      #3
      Thanks, but I'm looking to store both the submitted data and substring in a different field. Apologies if I wasn't very precise in the original post.

      Originally posted by FishVal
      [CODE=vb]

      Private Sub Text4_AfterUpda te()
      Me.Text4 = Left(Me.Text4, 8)
      End Sub

      [/CODE]

      Additional hidden field not needed.

      Good luck.

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        Originally posted by ReubenPatterson
        Thanks, but I'm looking to store both the submitted data and substring in a different field. Apologies if I wasn't very precise in the original post.
        [CODE=vb]

        Private Sub Text4_AfterUpda te()
        Me.Text5 = Left(Me.Text4, 8)
        End Sub

        [/CODE]

        But it is not needed and moreover not reccomended to store derived data as you can easily retrieve it from the table with query.

        SELECT Left(txtInput,8 ) AS txtLeft8Letters FROM tblTable;

        Comment

        Working...