Results 1 to 4 of 4
  1. #1
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    242

    Input Mask

    I have a text field on a form, I want the values to be saved in the table without any spaces in it. The size of the field is 17
    On the reports and forms I want to use an input mask that reserves the position of each character.
    On the Form / Report, I want to have a point (.) after each three character, The tenth character is a space. After the tenth character I might have three and some times four letters followed by another space and the 2 or 3 letters or digits.


    The first nine positions are only digits, in some cases I might have the first three digits and then I will move to the eleventh position which is a letter.

    What input mask should I use for this?
    What VBA should I use in the Lost focus or After Update event to remove the spaces if used when entering values by the user?

    Example:
    Value is: 395.09. ABC 12 or 395. 09. ABCD ind
    saved is table as: 39509abc12 saved as: 39509ABCDind

    Khalil

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    don't think an input mask will work in this case because of the varying number of characters after 'abc'

    suggest use the afterupdate event to remove both spaces and dots

    vba would be

    myfield=replace(replace(myfield,".","")," ","")

  3. #3
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    the replace method does work well when there are unexpected spaces.....but it seems like you want to do a lot more than control just spaces so
    you might also consider a separate field (either bound or unbound) for each section/segment of this string. that way you can then merge together as you wish - - plus manage each section via mask independently....

  4. #4
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    242
    Thank you both for your reply.
    Space is one part for the issue and I think I also might need to separate it to more than one putting into consideration the position of the ( .) for each part.

    Khalil

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Input Mask
    By warmanlord in forum Access
    Replies: 11
    Last Post: 10-15-2015, 10:01 AM
  2. Input Mask
    By kdbailey in forum Access
    Replies: 4
    Last Post: 12-19-2014, 08:11 AM
  3. Input mask
    By scorpion99 in forum Access
    Replies: 4
    Last Post: 02-21-2014, 02:18 AM
  4. Input Mask
    By qbc in forum Access
    Replies: 2
    Last Post: 01-20-2012, 03:27 PM
  5. Input mask
    By doobybug in forum Access
    Replies: 2
    Last Post: 06-17-2009, 09:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums