Results 1 to 10 of 10
  1. #1
    frankmanl is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2023
    Posts
    9

    save input with space at the right position (postal code)

    In my input form I use a field for the postal code. The dutch postal code is like "1111 AA"


    For this form field I use an input mask "0000\ >LL" which shows the desired result in my form.
    But my input is stored in the table as "1111AA".
    How can I get the space between the numbers and the characters in my table?

    BTW: The field in the table has no mask whatsoever.

    Frank

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    If the postcodes ALWAYS follow that pattern , use an update query

    Code:
    UPDATE YourTableName SET YourTableName.Postcode = Left([postcode],4) & ' ' & Mid([Postcode],5);
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Can't you just adjust it in the AfterUpdate of the control?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    Quote Originally Posted by frankmanl View Post
    How can I get the space between the numbers and the characters in my table?
    Why should you want that if it is OK on the form?
    If you want, you can apply the same mask to the table.
    Groeten,

    Peter

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    there is a setting where the input mask format can be saved to the underlying field

    https://learn.microsoft.com/en-us/of...tbox.inputmask

  6. #6
    frankmanl is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2023
    Posts
    9
    Thank you for all your replies.
    I use an export of the table to create mailinglists, so that is why it's important the data are stored with a space betweennumbers and characters.
    Applying the same mask to the table field is the right solution for me, thank you Peter.
    Frank

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    that is why it's important the data are stored with a space
    di you are happy to kid yourself that what you see is what you’ve got?

    if you see ‘1234 AB’ how do your know it is not actually stored as ‘1234ab’. If you never need the field for criteria, filtering or sorting, probably won’t matter but why kid yourself?

  8. #8
    frankmanl is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2023
    Posts
    9
    Oh, I see what you mean: it is still stored as 1234AB - without the space.
    The right solution seems to be:
    • no mask for the table field
    • mask for the form field is now "0000\ >LL;0;_"
    The zero after the first semicolon makes the data to be stored as displayed by the mask: with a space between the numbers and characters.
    Thank you CJ, for pointing this out.
    Frank

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by frankmanl View Post
    Thank you for all your replies.
    I use an export of the table to create mailinglists, so that is why it's important the data are stored with a space betweennumbers and characters.
    Applying the same mask to the table field is the right solution for me, thank you Peter.
    Frank
    In which case you could format it as you wish?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Deleted

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

Similar Threads

  1. Replies: 2
    Last Post: 08-31-2017, 07:52 AM
  2. Replies: 2
    Last Post: 09-01-2015, 02:57 AM
  3. Replies: 2
    Last Post: 07-15-2015, 08:35 PM
  4. Replies: 1
    Last Post: 11-04-2014, 12:07 PM
  5. Replies: 4
    Last Post: 07-09-2013, 09:10 PM

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