Hi,
How to format a text box on a form as follows:
Three letters only first letter in Capital, space, four numbers.
All of them are obligatory.
Example: Bac 1230
Thanks
Khalil
Hi,
How to format a text box on a form as follows:
Three letters only first letter in Capital, space, four numbers.
All of them are obligatory.
Example: Bac 1230
Thanks
Khalil
Use:
\B\a\c 0000
Hi,
When I typed the above value, it was replaced with:
"Bac "0000
And when trying to type a value in the text box it gives the following error:
Note the text box is unbounded.
Khalil
https://chatgpt.com/c/680639ff-d7e0-...a-715de8eb5abc
It does not show VBA explicitly, but the Shell option looks familiar.
Then there is MS
https://support.microsoft.com/en-gb/...8-6138c4aeda6d
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
"Bac "0000 works as well, as here for a value of 12:
![]()
Using the format from the link I posted.
I entered in lowercase cgr1234
The picture shows the result.
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
Welsh, the ChatGPT link does not work.
Khalil, not clear to me what you want.
Do you want the literal characters "Bac" or was this just an example of the alpha content and there could be any 3 letters?
So user could input xyz 15 or XYZ 15 and you want output as Xyz 0015? I think this will require VBA.
Can use an InputMask to force structure of 3 alpha and 4 numbers but user would have to enter all 8 characters, including any placeholder zeros and space. Then VBA in textbox After Update event could make sure lead character is upper case with:
Me.textboxname = StrConv(Me.textboxname, vbProperCase)
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Works for me, but perhaps as I created it, but I have used that link twice from here, rather than asking the question again?Welsh, the ChatGPT link does not work.
Khalil, not clear to me what you want.
Do you want the literal characters "Bac" or was this just an example of the alpha content and there could be any 3 letters?
So user could input xyz 15 and you want output as Xyz 0015? I think this will require VBA.
Can use an InputMask to force structure of 3 alpha and 4 numbers but user would have to enter all 7 characters, including any placeholder zeros. Then VBA in textbox After Update event could make sure lead character is upper case with:
Me.textboxname = StrConv(Me.textboxname, vbProperCase)
However that is only to show a particular format. The actual data is unchanged? That is my understanding, so if you check for it, you need 'cgr1234'
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
Welsh, just tells me "Unable to load conversation".
Okay, did not catch onto mixing upper and lower case format characters for input mask. User still must enter all characters. Access will popup error message for invalid input.
If you want to save value with formatted structure, set InputMask as: >L<LL\ 0000;0
And VBA is not needed after all.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi to all,
thank you for all the effort to help me.
To clear things:
My format for this unbounded text box consists of three letters, space, and four numbers. All of them should be there.
Examples:
Mar 1235, Bzx 2254, or Klm 2130
I tried the following: >L<LL\ 0000
When pressing Enter key after typing it changes to the following: ><\L"LL 0000" (I don't know why)
When typing the value: klm 2130
The text box shows: LLL 0000klm 2130
Khalil
Upload your dB, else we will be here all day on this.![]()
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
Sorry, accidentally posted twice.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Suggestion is to use InputMask property, not Format. Review posts 7, 8 and 9.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi
I used the InputMask as: >L<LL\ 0000;0
Thank you all for all the help.
Solved
Khalil