Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force first three characters (97)

    Force first three characters
    I have an IRD field 11 char long whose first 3 characters are always R00 followed by 8 digits.
    But how do I use an input mask to force the 2nd & 3rd characters (the zeros) There

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force first three characters (97)

    If they are always there, why do you want to store them in the data ? Use a 8 digit field and put the R00 in the label.
    It should save space and typing.
    Francois

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force first three characters (97)

    Hi Francois!
    Because databases in the company already exist as do shipping files, they ALL contain R00 in the first 3 characters, if I don

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Force first three characters (97)

    Hi,
    Try "R00"00000000 as your input mask (they won't need to type the R00 bit, just the last 8 numbers.)
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force first three characters (97)

    Excellent, thank you very much.

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force first three characters (97)

    OK.
    In the on Exit of the textbox put some code.
    <pre>Private Sub txtField_Exit(Cancel As Integer)
    If Left(Me.txtField,3) <> "R00" Then
    Msgbox "Please begin the string with R00"
    Cancel = True
    End If
    End Sub</pre>

    You could also set R00 as default for the txtField and in the On enter event :
    <pre>Private Sub txtField_Enter()
    If Me.NewRecord Then
    Me.txtField.SelStart = Len(Me.txtField)
    End IF
    End Sub</pre>

    This would enter R00 for new records and position the cursor at the end of R00 only for new records.
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •