473,386 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

multiple input mask

hi everyone..

i read on another forum that it is possible to define multiple input masks for a textbox (for example).

There is a textbox field where you can enter the name of a machine.
The user should only have two possibilities:

HOSTx-xxx vba: HOST9-99C ? like HOST2-45 or HOST9-245
(C can be 'nothing', right or not?)

or
SRV000xxx like SRV000105

So how can i combine two input masks?
The following is not working..
Expand|Select|Wrap|Line Numbers
  1. Me.txt_computer.InputMask = "HOST9-99C;;_" Or "SRV000999;;_"
Another question: how can I force the text HOST or SRV000?

Thanks
Aug 26 '09 #1
5 9807
ADezii
8,834 Expert 8TB
@ezechiel
I do believe that you can only define a Single Input Mask which does nothing for your case. What you can do is to write code in the BeforeUpdate() Event of the Text Box that insures that only a few valid formats will be entered. If not, then the Update is cancelled.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Text94_BeforeUpdate(Cancel As Integer)
  2. Dim txt As TextBox
  3. Dim intCharPos As Integer
  4.  
  5. Set txt = Me![Text94]
  6.  
  7. If txt Like "HOST9-[0-9][0-9]" Or txt Like "HOST9-[0-9][0-9][0-9]" _
  8.              Or txt Like "SRV000[0-9][0-9][0-9]" Then
  9. Else
  10.   MsgBox "Invalid Entry" & vbCrLf & vbCrLf & "Valid Codes should be " & _
  11.          "HOST9-xx, HOST9-xxX, or SRV000xxx where x is a Numeric Value.", _
  12.           vbExclamation, "Entry Not Valid"
  13.             Cancel = True
  14. End If
  15. End Sub
Aug 29 '09 #2
ADezii
8,834 Expert 8TB
There is one point that I should clarify after careful consideration. You can define Multiple Input Masks based on the value of another Field, as in:
Expand|Select|Wrap|Line Numbers
  1. If Me![<Some Field>] = <Value> Then
  2.   Me![<Another Field>].InputMask = "<Input Mask 1>"
  3. Else
  4.   Me![<Another Field>].InputMask = "<Input Mask 2>"
  5. End If
Aug 30 '09 #3
missinglinq
3,532 Expert 2GB
I think ADezii has covered this well! You can assign multiple Input Masks, but only one at a time (as demonstrated in his second post) prior to entering data into the target control. I would think you would also have to insure that the target control was locked until whatever condition was met that led to a particular Input Mask being assigned.

For the scenario given by the OP here, I would think that Validation code, executed after the data has been entered, such as ADezii's first post gives, would be the way to go.

Linq ;0)>
Aug 30 '09 #4
Ok,

thanks for the answers people!! I think every solution has been covered here.
You just made the first interesting post (with solution) on the internet concerning this problem!!! (I googled around a lot, but every time, people suggest to use two textboxes, add a field in DB or other stuff.)

So, finally a couple of usefull answers! :D

Thanks again!
Aug 31 '09 #5
NeoPa
32,556 Expert Mod 16PB
@ezechiel
That's why I stuck around in the first place if truth be told. I had a couple of long-standing issues that I could find answers to anywhere.

I remember Mary (msquared) was able to answer one for me from her own personal understanding, and another was answered too. Much to my surprise I admit. I'd pretty well given up hope of finding answers ever.
Aug 31 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: dude | last post by:
hello how would i make an input mask that only makes the first letter a capitol one? i've been playing around and testing various masks, also tried the wizard, but i've had no luck. could...
2
by: Ellen Manning | last post by:
I've got an A2K database with a link to a table in another A2K database. This linked table contains SSN formatted with the SSN input mask. I'm trying to use a dlookup using this linked table. ...
9
by: Paul | last post by:
hi, is there an input mask i could use on a report to do the following: (1) if i enter "THISISATEST" on my form, i want the text box on my report to display: "T H I S I S A T E S T". (2) if...
2
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I...
7
by: F. Michael Miller | last post by:
I have a db with Access front end, sql back, linked tables. I need to be able to change input masks at the table level in code. Any ideas? Thanks!
3
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't...
5
by: social_engin33r | last post by:
Hello, I've been asked to help someone set up a database. One of the fields in the database is a text field that holds data imported in this format: 11-A-11-11 The users prefer to see the...
9
by: msnews.microsoft.com | last post by:
Hello. How can I set input mask for TextBox? Or can I use for mask input some other control?
7
desklamp
by: desklamp | last post by:
I'm a total Access newbie, please bear with me! Using Win2K/Access 2003. I'm trying to create a table in which I can store IP addresses and other information. According to Microsoft, there is no...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.