473,385 Members | 1,396 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,385 software developers and data experts.

input mask using value from other field

Hi, I'd like to make an input mask, based on another field's value. For example, if the value of the other field (in another table) is 125, then i want my input mask to start with 125, subsequently adding three more digits for the user to fill in. So something like: 125 - _ _ _

Is this possible? If so, is it also possible to use a field from the same record? Using Access 2003 on Win XP.

Thanks a lot!
Mar 7 '07 #1
5 3799
ADezii
8,834 Expert 8TB
Hi, I'd like to make an input mask, based on another field's value. For example, if the value of the other field (in another table) is 125, then i want my input mask to start with 125, subsequently adding three more digits for the user to fill in. So something like: 125 - _ _ _

Is this possible? If so, is it also possible to use a field from the same record? Using Access 2003 on Win XP.

Thanks a lot!
You need to set the Input Mask programmmatically in the AfterUpdate() Event of the 1st Field.
Assumptions:
__1 Field1 Name - txtTextBox1
__2 Field2 Name - txtTextBox2
__3 Input Mask on txtTextBox2 (Phone#) - "(###) ###-####"
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtTextBox1_AfterUpdate()
  2. If Me![txtTextBox1] = 125 Then
  3.   Me![txtTextBox2].InputMask = "(###) ###-####"
  4. End If
  5. End Sub
Mar 7 '07 #2
thanks for your help! you put me on the right path. I modified the code a bit to read:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text2_GotFocus()
  2.   Me![Text2].InputMask = Me![Text0] & "-###"
  3. End Sub
However, when i input a value in field Text0 that has zeros, then the input mask for field Text2 will interpret that as a place for a digit. I can circumvent this by placing \ in front of every zero, but is there any way to go around this? I.e.: if a user types 100 in field Text0, that the input mask in field Text2 will be 100- _ _ _
Mar 8 '07 #3
NeoPa
32,556 Expert Mod 16PB
Expand|Select|Wrap|Line Numbers
  1. Private Sub Text2_GotFocus()
  2.   Me.[Text2].InputMask = Replace(Me.[Text0],"0","\0") & "-###"
  3. End Sub
Mar 8 '07 #4
works like a charm. thanks a lot!
Mar 9 '07 #5
NeoPa
32,556 Expert Mod 16PB
Happy to help :)
Mar 9 '07 #6

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

Similar topics

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. ...
1
by: Miranda Evans | last post by:
In my application, a text box control resides in a form. The text box control is unbound, but--assuming all edits are passed when the user click a command button on the form--the contents of the...
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: Vincent van Beveren | last post by:
Hi everyone, I have a page with a login box. Because of lack of space, instead of labels I put the descriptive text in the input fields (so username input says 'username', and password input...
2
by: sparks | last post by:
Can you do this. We have some fields with double set and an input mask of fixed decimal place 2 input mask ###.## works great..
1
by: Doug | last post by:
Hi, I created a short date field. The format is dd/mm/yyyy when displayed. The input mask is set to 99/99/00;0 (default, I didn't type anything). If I edit an existing date, say change...
3
by: Guig | last post by:
Hi, I have a problem with one of my form. I want to record some data in a table by using a form. One of those data it is the time and I want to use an input mask to be sure that everyone will...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.